You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: styleguide/template.md
+57-48Lines changed: 57 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,24 @@
1
1
# Metadata and Markdown Template for C++ Docs
2
2
3
-
This C++ repo-specific core-docs template contains examples of Markdown syntax, as well as guidance on setting the metadata. To get the most of it, you must view both the [raw Markdown](https://raw.githubusercontent.com/dotnet/docs/master/styleguide/template.md) and the [rendered view](https://github.com/dotnet/docs/blob/master/styleguide/template.md) (for instance, the raw Markdown shows the metadata block, while the rendered view does not).
3
+
This C++ repo-specific core-docs template contains examples of Markdown syntax, and guidance on setting the metadata. To get the most of it, you must view both the [raw Markdown](https://raw.githubusercontent.com/MicrosoftDocs/cpp-docs/main/styleguide/template.md) and the [rendered view](https://github.com/MicrosoftDocs/cpp-docs/blob/master/styleguide/template.md) (for instance, the raw Markdown shows the metadata block, while the rendered view doesn't).
4
4
5
5
When creating a Markdown file, you should copy this template to a new file, fill out the metadata as specified below, set the H1 heading above to the title of the article, and delete the content.
6
6
7
7
## Metadata
8
8
9
-
The full metadata block is yaml data between two lines that only contain `---`above the document contents (in the [raw Markdown](https://raw.githubusercontent.com/dotnet/docs/master/styleguide/template.md)). It's divided into required fields and optional fields. Some key notes:
9
+
The full metadata block is yaml data between two lines that only contain `---`at the top of the document contents (in the [raw Markdown](https://raw.githubusercontent.com/MicrosoftDocs/cpp-docs/main/styleguide/template.md)). It's divided into required fields and optional fields. Some key notes:
10
10
11
-
- You **must** have a space between the colon (:) and the value for a metadata element.
12
-
- If an optional metadata element does not have a value, comment out the element with a `#` or remove it (do not leave it blank or use "na"); if you are adding a value to an element that was commented out, be sure to remove the `#`.
11
+
- You **must** have a space between the colon (`:`) and the value for a metadata element.
12
+
- If an optional metadata element doesn't have a value, comment out the element with a `#` or remove it (don't leave it blank or use "na"); if you're adding a value to an element that was commented out, be sure to remove the `#`.
13
13
- Colons in a value (for example, a title) break the metadata parser. In this case, surround the title with double quotes (for example, `title: "Writing Windows console apps: An advanced step-by-step guide"`).
14
-
-**`title`**: This title will appear in search engine results. You can also add a pipe (|) followed by the product name (for example, `title: Developing Libraries with Cross Platform Tools | Microsoft C++`). The title doesn't need be identical to the title in your H1 heading and it should contain 65 characters or less (including | PRODUCT NAME).
15
-
-**`author`**, **`manager`**, **`ms.author`**: These values are optional and will default to per-directory settings in the *`docfx.json`* file. Set them only if the value should be different from the default. The `author` field should contain the **GitHub username** of the author, not their alias. The `manager` and `ms.author` fields, on the other hand, should contain Microsoft aliases. We don't normally include the **`ms.reviewer`** value, but if present, it specifies the name of the PM/dev associated with the article or feature.
16
-
-**`ms.devlang`** defines the technology. This value is optional and will default to per-directory settings in the *`docfx.json`* file. Set it only if the value should be different from the default. Some of the supported values are: `dotnet`, `cpp`, `csharp`, `fsharp`, `vb` and `xml`.
17
-
-**`ms.assetid`**: Do not set this value in new articles. It exists only as a historical link to archived versions of the document.
14
+
-**`title`**: This title will appear in search engine results. You can also add a pipe (|) followed by the product name (for example, `title: Developing Libraries with Cross Platform Tools | Microsoft C++`). The default product name is set in the *`docfx.json`* file, so only specify it if necessary. The title doesn't need to be identical to the title in your H1 heading. It should contain 65 characters or less (including \| PRODUCT NAME).
15
+
-**`author`**, **`manager`**, **`ms.author`**: These values are optional and will default to per-directory settings in the *`docfx.json`* file. Set them only if the value is different from the default. The `author` field should contain the **GitHub username** of the author, not their alias. The `manager` and `ms.author` fields, on the other hand, should contain Microsoft aliases. We don't normally include the **`ms.reviewer`** value, but if present, it specifies the name of the PM/dev associated with the article or feature.
16
+
-**`ms.devlang`** defines the technology. This value is optional and will default to per-directory settings in the *`docfx.json`* file. Set it only if the value is different from the default. Some of the supported values are: `dotnet`, `cpp`, `csharp`, `fsharp`, `vb` and `xml`.
17
+
-**`ms.assetid`**: Don't set this value in new articles. It exists only as a historical link to archived versions of the document.
18
18
19
19
## Basic Markdown, GFM, and special characters
20
20
21
-
All basic and GitHub Flavored Markdown (GFM) is supported. For more information on these, see:
21
+
All basic and GitHub Flavored Markdown (GFM) is supported. For more information on Markdown, see:
@@ -27,7 +27,7 @@ Markdown uses special characters such as \*, \`, and \# for formatting. If you w
27
27
28
28
- Put a backslash before the special character to "escape" it (for example, `\*` for a \*)
29
29
- Use the [HTML entity code](https://www.ascii.cl/htmlcodes.htm) for the character (for example, `*` for a *).
30
-
- Markdown allows you to use two spaces at the end of a line to indicate a line break. Because this is invisible in most editors and easy to break, use the alternative of a single backslash (`\`) instead.
30
+
- Markdown allows you to use two spaces at the end of a line to indicate a line break. Because the spaces are invisible in most editors and easy to break, use the alternative of a single backslash (`\`) instead.
31
31
32
32
## Markdown editing tools
33
33
@@ -41,11 +41,11 @@ You can use [Visual Studio Code](https://code.visualstudio.com/) to edit Markdow
41
41
File names use the following rules:
42
42
43
43
- Contain only lowercase letters, numbers, and hyphens.
44
-
- No spaces or punctuation characters. Use the hyphens to separate words and numbers in the file name.
45
-
- Use action verbs that are specific, such as develop, buy, build, troubleshoot. No -ing words.
46
-
- No small words - don't include a, and, the, in, or, etc.
47
-
- Must be in Markdown and use the .md file extension.
48
-
- Keep file names reasonably short. They are part of the URL for your articles.
44
+
- No spaces or punctuation characters. Use hyphens to separate words and numbers in the file name.
45
+
- Use action verbs that are specific, such as "develop", "buy", "build", "troubleshoot". Don't use "-ing" words.
46
+
- No small words: Don't include "a", "and", "the", "in", "or", and so on.
47
+
- Must be in Markdown and use the `.md` file extension.
48
+
- Keep file names reasonably short. They're part of the URL for your articles.
49
49
50
50
## Headings
51
51
@@ -54,13 +54,13 @@ Use sentence-style capitalization. Always capitalize:
54
54
- The first word of a heading.
55
55
- The word following a colon in a title or heading (for example, "How to: Sort an array").
56
56
57
-
Headings should be done using atx-style, that is, use 1-6 hash characters (#) at the start of the line to indicate a heading, corresponding to HTML headings levels H1 through H6. Examples of first- and second-level headers are used above.
57
+
Headings should be done using atx-style, that is, use 1-6 hash characters (`#`) at the start of the line to indicate a heading, corresponding to HTML headings levels H1 through H6. Examples of first- and second-level headers are used above.
58
58
59
-
There **must** be only one first-level heading (H1) in your topic, which will be displayed as the on-page title.
59
+
There **must** be only one first-level heading (H1) in your article, which will be displayed as the on-page title.
60
60
61
-
If your heading finishes with a `#` character, you need to add an extra `#` character in the end in order for the title to render correctly. For example, `# Async Programming in F# #`.
61
+
If your heading ends with a `#` character, you need to add an extra `#` character in the end in order for the title to render correctly. For example, `# Async Programming in F# #`.
62
62
63
-
There should always be one blank line before and after a heading (except for first-level headings, which should not have a blank line before).
63
+
There should always be one blank line before and after a heading (except for first-level headings, which shouldn't have a blank line before).
64
64
65
65
Second-level headings will generate the on-page TOC that appears in the "In this article" section underneath the on-page title.
66
66
@@ -77,30 +77,36 @@ Second-level headings will generate the on-page TOC that appears in the "In this
77
77
## Text styling
78
78
79
79
*Italics*\
80
+
\*Italics\*\
80
81
Use for user-generated filenames, folders, and paths (for long items, split onto their own line); new terms; user-entered values; and URLs (unless rendered as links, which is the default).
81
82
82
83
**Bold**\
84
+
\*\*Bold\*\*\
83
85
Use for UI elements.
84
86
85
87
**`Bold Code`**\
88
+
\*\*\`Bold Code\`\*\*\
86
89
Use for keywords, operators, and compiler and tool options.
87
90
88
91
*`Italic Code`*\
92
+
\*\`Italic Code\`\*\
89
93
Use for parameters.
90
94
91
-
`Code`\
92
-
Use for non-localizable elements, filenames, and inline code such as a single variable, expression, or statement.
95
+
`Inline Code`\
96
+
\`Inline Code\`\
97
+
Use for non-localizable elements such as library function names, preprocessor macros, fixed filenames, and inline code such as a single variable, expression, or statement.
93
98
94
-
> Blockquote
99
+
> Blockquote\
100
+
\> Blockquote
95
101
96
102
Use blockquote for error and warning messages, syntax sections, and EBNF content.
97
103
98
104
## Links
99
105
100
106
### Internal Links
101
107
102
-
To link to a header in the same Markdown file (also known as anchor links), you'll need to find out the id of the header you're trying to link to. To confirm the ID, view the source of the rendered article, find the id of the header (for example, `id="blockquote"`), and link using # + id (for example, `#blockquote`).
103
-
The id is auto-generated based on the header text. So, for example, given a unique section named `## Step 2`, the id would look like this `id="step-2"`.
108
+
To link to a header in the same Markdown file (also known as anchor links), you'll need to find out the ID of the header you're trying to link to. To confirm the ID, view the source of the rendered article, find the ID of the header (for example, `id="blockquote"`), and link using `#` + ID (for example, `#blockquote`).
109
+
The ID is auto-generated based on the header text. So, for example, given a unique section named `## Step 2`, the ID would look like this `id="step-2"`.
104
110
105
111
- Example: [Chapter 1](#chapter-1)
106
112
@@ -115,7 +121,7 @@ To link to a header in a Markdown file in the same repo, use relative linking +
115
121
116
122
### Docs Links
117
123
118
-
To link to a file in a different Docs repo, use the docs.microsoft.com relative URL as the link. Do not include the .md suffix or the language/locale element.
124
+
To link to a file in a different Docs repo, use the docs.microsoft.com relative URL as the link. Don't include the .md suffix or the language/locale element.
119
125
120
126
- Example: [Universal Windows Platform documentation](/windows/uwp)
121
127
@@ -131,10 +137,11 @@ If a URL appears in a Markdown file, it will be transformed into a clickable lin
131
137
132
138
### Links to APIs
133
139
134
-
The build system has some extensions that allow us to link to Managed APIs without having to use external links.
140
+
The build system has some extensions that allow us to link to Managed APIs without having to use external links.
141
+
135
142
When linking to an API, you can use its unique identifier (UID) that is auto-generated from the source code.
136
143
137
-
You can use one of the following syntax:
144
+
You can use one of the following syntax forms:
138
145
139
146
1. Markdown link: `[link_text](xref:UID)`
140
147
2. Auto link: `<xref:UID>`
@@ -149,7 +156,7 @@ For more information about using this notation, see [Using cross reference](http
149
156
150
157
When the UID contains the special characters \` or \#, the UID value needs to be HTML encoded as %60 and %23 respectively as in the following examples:
@@ -158,8 +165,8 @@ Lists should be surrounded by blank lines.
158
165
159
166
### Ordered lists
160
167
161
-
1.This
162
-
1.Is
168
+
1.Example
169
+
1.Of
163
170
1. An
164
171
1. Ordered
165
172
1. List
@@ -170,30 +177,30 @@ Lists should be surrounded by blank lines.
170
177
1. comes
171
178
1. an
172
179
1. embedded
173
-
1.Miss Scarlett
174
-
1.Professor Plum
180
+
1.Scarlet
181
+
1. Plum
175
182
1. ordered
176
183
1. list
177
184
178
185
### Unordered Lists
179
186
180
-
-This
181
-
-is
187
+
-Example
188
+
-of
182
189
- a
183
190
- bulleted
184
191
- list
185
192
186
193
#### Unordered list with an embedded list
187
194
188
-
-This
195
+
-Sometimes
189
196
- bulleted
190
-
-list
191
-
-Mrs. Peacock
192
-
-Mr. Green
193
-
-contains
197
+
-lists
198
+
-Chartreuse
199
+
-Lime
200
+
-contain
194
201
- other
195
-
1.Colonel Mustard
196
-
1.Mrs. White
202
+
1.Magenta
203
+
1.Fuchsia
197
204
- lists
198
205
199
206
## Horizontal rule
@@ -209,7 +216,7 @@ ___
209
216
| col 1 is default | left-aligned | $1 |
210
217
211
218
You can use a [Markdown table generator tool](https://www.tablesgenerator.com/markdown_tables) to help creating them more easily. See also [Markdown editing tools](#markdown-editing-tools).
212
-
The C++ standard is to use the table format created by the **`Docs: Consolidate selected table`** tool in the Docs Authoring Pack. Don't try to align the vertical lines in your tables; it's just extra work that's easy to break.
219
+
The C++ standard is to use the table format created by the **`Docs: Consolidate selected table`** tool in the Docs Authoring Pack. Don't try to align the vertical lines in your tables; it's extra work that's easy to break.
213
220
214
221
## Code
215
222
@@ -239,7 +246,7 @@ code that should be included. Use the `#region` and `#endregion` preprocessor sy
239
246
to specify the region of code to include.
240
247
241
248
For cases where regions don't work, you can specify the start and end of a snippet
242
-
using an XML element name in a single line comment. For example, you could write this in C#:
249
+
using an XML element name in a single line comment. For example, you could write this sample region in C#:
243
250
244
251
```csharp
245
252
// <CodeToInclude>
@@ -252,15 +259,15 @@ int sum = i + j;
252
259
In other languages, use the comment syntax for that language.
253
260
254
261
Finally, you can use line numbers: `#L1-L10` would include lines 1 through 10. We discourage line numbers
255
-
because they are very brittle.
262
+
because they're brittle.
256
263
257
264
Including snippets from full programs ensures that all code runs through our Continuous Integration (CI)
258
265
system. However, if you need to show something that causes compile time or runtime errors, you can
259
266
use inline code blocks.
260
267
261
268
### Inline code blocks with language identifier
262
269
263
-
Use three backticks (\`\`\`) + a language ID to apply language-specific color coding to a code block. Here is the entire list of [GFM language IDs](https://github.com/jmm/gfm-lang-ids/wiki/GitHub-Flavored-Markdown-(GFM)-language-IDs).
270
+
Use three backticks (\`\`\`) + a language ID to apply language-specific color coding to a code block. Here's the entire list of [GFM language IDs](https://github.com/jmm/gfm-lang-ids/wiki/GitHub-Flavored-Markdown-(GFM)-language-IDs).
264
271
265
272
#### C++
266
273
@@ -356,16 +363,18 @@ Use backticks (`) for `inline code`. Use inline code for command-line comman
356
363
### Shows
357
364
358
365
[
0 commit comments