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
+60-25Lines changed: 60 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,20 @@
1
-
# Metadata and Markdown Template
1
+
# Metadata and Markdown Template for C++ Docs
2
2
3
-
This 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, 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).
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 above (in the [raw Markdown](https://raw.githubusercontent.com/dotnet/docs/master/styleguide/template.md)), divided into required fields and optional fields. Some key notes:
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:
10
10
11
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 #.
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 .NET Core 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 | .NET Core`). 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.reviewer**: The author field should contain the **GitHub username** of the author, not their alias. The "manager" and "ms.reviewer" fields, on the other hand, should contain Microsoft aliases. ms.reviewer specifies the name of the PM/dev associated with the article or feature.
16
-
-**ms.devlang** defines the technology. Some of the supported values are: `dotnet`, `cpp`, `csharp`, `fsharp`, `vb` and `xml`.
17
-
-**ms.assetid**: This is the GUID of the article that is used for internal tracking purposes such as Business Intelligence (BI). When creating a new Markdown file, you can get a GUID from [Online GUID Generator](https://www.guidgenerator.com/).
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 `#`.
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.
18
18
19
19
## Basic Markdown, GFM, and special characters
20
20
@@ -27,12 +27,13 @@ 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
31
31
32
## Markdown editing tools
32
33
33
34
You can use [Visual Studio Code](https://code.visualstudio.com/) to edit Markdown documents. VS Code has many helpful Markdown extensions, such as:
34
35
35
-
-[docs-markdown](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown) by Microsoft
36
+
-[Docs Authoring Pack](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-authoring-pack) by Microsoft
@@ -59,7 +60,7 @@ There **must** be only one first-level heading (H1) in your topic, which will be
59
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
62
62
-
There should always be one blank line before and after a heading (except for first-level headings).
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
64
64
65
Second-level headings will generate the on-page TOC that appears in the "In this article" section underneath the on-page title.
65
66
@@ -75,11 +76,24 @@ Second-level headings will generate the on-page TOC that appears in the "In this
75
76
76
77
## Text styling
77
78
78
-
*Italics*
79
-
Use for user-generated filenames, folders, and paths (for long items, split onto their own line); new terms; parameter names; user-entered values; and URLs (unless rendered as links, which is the default).
79
+
*Italics*\
80
+
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).
80
81
81
-
**Bold**
82
-
Use for UI elements and language keywords.
82
+
**Bold**\
83
+
Use for UI elements.
84
+
85
+
**`Bold Code`**\
86
+
Use for keywords, operators, and compiler and tool options.
87
+
88
+
*`Italic Code`*\
89
+
Use for parameters.
90
+
91
+
`Code`\
92
+
Use for non-localizable elements, filenames, and inline code such as a single variable, expression, or statement.
93
+
94
+
> Blockquote
95
+
96
+
Use blockquote for error and warning messages, syntax sections, and EBNF content.
83
97
84
98
## Links
85
99
@@ -101,7 +115,7 @@ To link to a header in a Markdown file in the same repo, use relative linking +
101
115
102
116
### Docs Links
103
117
104
-
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.
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.
105
119
106
120
- Example: [Universal Windows Platform documentation](/windows/uwp)
107
121
@@ -117,7 +131,7 @@ If a URL appears in a Markdown file, it will be transformed into a clickable lin
117
131
118
132
### Links to APIs
119
133
120
-
The build system has some extensions that allow us to link to .NET Core APIs without having to use external links.
134
+
The build system has some extensions that allow us to link to Managed APIs without having to use external links.
121
135
When linking to an API, you can use its unique identifier (UID) that is auto-generated from the source code.
122
136
123
137
You can use one of the following syntax:
@@ -188,13 +202,14 @@ ___
188
202
189
203
## Tables
190
204
191
-
| Tables | Are | Cool|
192
-
| ------------- |:-------------:| -----:|
193
-
| col 3 is | right-aligned | $1600 |
194
-
| col 2 is | centered | $12 |
195
-
| col 1 is default | left-aligned | $1 |
205
+
| Tables | Are | Cool |
206
+
|--|:-:|-:|
207
+
| col 3 is | right-aligned | $1600 |
208
+
| col 2 is | centered | $12 |
209
+
| col 1 is default | left-aligned | $1 |
196
210
197
211
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.
198
213
199
214
## Code
200
215
@@ -247,6 +262,26 @@ use inline code blocks.
247
262
248
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).
249
264
265
+
#### C++
266
+
267
+
```cpp
268
+
#include<iostream>
269
+
intmain()
270
+
{
271
+
std::cout << "Hello World!\n";
272
+
}
273
+
```
274
+
275
+
#### C
276
+
277
+
```C
278
+
#include<stdio.h>
279
+
intmain()
280
+
{
281
+
printf("Hello World!\n");
282
+
}
283
+
```
284
+
250
285
#### C\#
251
286
252
287
```csharp
@@ -318,10 +353,10 @@ Use backticks (`) for `inline code`. Use inline code for command-line comman
318
353
319
354
## Videos
320
355
321
-
### Channel 9
356
+
### Shows
322
357
323
-
[
[
0 commit comments