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
+81-60Lines changed: 81 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,9 @@
2
2
3
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).
4
4
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.
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
-
8
-
## Metadata
7
+
## Metadata
9
8
10
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:
11
10
@@ -14,8 +13,8 @@ The full metadata block is above (in the [raw Markdown](https://raw.githubuserco
14
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"`).
15
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).
16
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.
17
-
-**ms.devlang** defines the technology. Some of the supported values are: dotnet, cpp, csharp, fsharp, vb and xml.
18
-
-**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, get a GUID from [https://www.guidgenerator.com](https://www.guidgenerator.com).
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/).
19
18
20
19
## Basic Markdown, GFM, and special characters
21
20
@@ -27,46 +26,60 @@ All basic and GitHub Flavored Markdown (GFM) is supported. For more information
27
26
Markdown uses special characters such as \*, \`, and \# for formatting. If you wish to include one of these characters in your content, you must do one of two things:
28
27
29
28
- Put a backslash before the special character to "escape" it (for example, `\*` for a \*)
30
-
- Use the [HTML entity code](http://www.ascii.cl/htmlcodes.htm) for the character (for example, `*` for a *).
29
+
- Use the [HTML entity code](https://www.ascii.cl/htmlcodes.htm) for the character (for example, `*` for a *).
30
+
31
+
## Markdown editing tools
32
+
33
+
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
+
-[docs-markdown](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown) by Microsoft
* Contain only lowercase letters, numbers, and hyphens.
36
-
* No spaces or punctuation characters. Use the hyphens to separate words and numbers in the file name.
37
-
* Use action verbs that are specific, such as develop, buy, build, troubleshoot. No -ing words.
38
-
* No small words - don't include a, and, the, in, or, etc.
39
-
* Must be in Markdown and use the .md file extension.
40
-
* Keep file names reasonably short. They are part of the URL for your articles.
41
-
42
41
42
+
- Contain only lowercase letters, numbers, and hyphens.
43
+
- No spaces or punctuation characters. Use the hyphens to separate words and numbers in the file name.
44
+
- Use action verbs that are specific, such as develop, buy, build, troubleshoot. No -ing words.
45
+
- No small words - don't include a, and, the, in, or, etc.
46
+
- Must be in Markdown and use the .md file extension.
47
+
- Keep file names reasonably short. They are part of the URL for your articles.
43
48
44
49
## Headings
45
50
46
51
Use sentence-style capitalization. Always capitalize:
47
-
- The first word of a heading.
48
-
- The word following a colon in a title or heading (for example, "How to: Sort an array").
49
52
50
-
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.
53
+
- The first word of a heading.
54
+
- The word following a colon in a title or heading (for example, "How to: Sort an array").
55
+
56
+
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.
51
57
52
58
There **must** be only one first-level heading (H1) in your topic, which will be displayed as the on-page title.
53
59
54
-
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# #`.
60
+
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
+
There should always be one blank line before and after a heading (except for first-level headings).
55
63
56
64
Second-level headings will generate the on-page TOC that appears in the "In this article" section underneath the on-page title.
57
65
66
+
```markdown
58
67
### Third-level heading
68
+
59
69
#### Fourth-level heading
70
+
60
71
##### Fifth level heading
72
+
61
73
###### Sixth-level heading
62
-
74
+
```
75
+
63
76
## Text styling
64
77
65
-
*Italics*
66
-
Use for files, folders, paths (for long items, split onto their own line) - new terms - URLs (unless rendered as links, which is the default).
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).
67
80
68
-
**Bold**
69
-
Use for UI elements.
81
+
**Bold**
82
+
Use for UI elements and language keywords.
70
83
71
84
## Links
72
85
@@ -86,47 +99,55 @@ To link to a header in a Markdown file in the same repo, use relative linking +
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.
105
+
106
+
- Example: [Universal Windows Platform documentation](/windows/uwp)
107
+
89
108
### External Links
90
109
91
-
To link to an external file, use the full URL as the link.
110
+
To link to an external file, use the full URL as the link. Use HTTPS URL if applicable.
92
111
93
-
- Example: [GitHub](http://www.github.com)
112
+
- Example: [GitHub](https://www.github.com)
94
113
95
114
If a URL appears in a Markdown file, it will be transformed into a clickable link.
96
115
97
-
- Example: http://www.github.com
116
+
- Example: https://www.github.com
98
117
99
118
### Links to APIs
100
119
101
120
The build system has some extensions that allow us to link to .NET Core APIs without having to use external links.
102
121
When linking to an API, you can use its unique identifier (UID) that is auto-generated from the source code.
103
122
104
123
You can use one of the following syntax:
124
+
105
125
1. Markdown link: `[link_text](xref:UID)`
106
126
2. Auto link: `<xref:UID>`
107
127
3. Shorthand form: `@UID`
108
128
109
129
- Example: `@System.String`
110
-
- Example: `[String class](xref:System.String)`
130
+
- Example: `[String class](xref:System.String)`
111
131
112
132
For more information about using this notation, see [Using cross reference](https://dotnet.github.io/docfx/tutorial/links_and_cross_references.html#using-cross-reference).
113
133
114
-
> Right now, there is no easy way to find the UIDs. The best way to find the UID for an API is to search for it in this repo: [docascode/coreapi](https://github.com/docascode/coreapi). We're working on having a better system in the future.
134
+
> Right now, there is no easy way to find the UIDs. The best way to find the UID for an API is to search for it in this repository: [docascode/coreapi](https://github.com/docascode/coreapi). We're working on having a better system in the future.
115
135
116
136
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:
@@ -139,7 +160,6 @@ When the UID contains the special characters \` or \#, the UID value needs to be
139
160
1. ordered
140
161
1. list
141
162
142
-
143
163
### Unordered Lists
144
164
145
165
- This
@@ -148,11 +168,10 @@ When the UID contains the special characters \` or \#, the UID value needs to be
148
168
- bulleted
149
169
- list
150
170
171
+
#### Unordered list with an embedded list
151
172
152
-
##### Unordered list with an embedded list
153
-
154
-
- This
155
-
- bulleted
173
+
- This
174
+
- bulleted
156
175
- list
157
176
- Mrs. Peacock
158
177
- Mr. Green
@@ -162,7 +181,6 @@ When the UID contains the special characters \` or \#, the UID value needs to be
162
181
1. Mrs. White
163
182
- lists
164
183
165
-
166
184
## Horizontal rule
167
185
168
186
---
@@ -175,7 +193,7 @@ When the UID contains the special characters \` or \#, the UID value needs to be
175
193
| col 2 is | centered | $12 |
176
194
| col 1 is default | left-aligned | $1 |
177
195
178
-
You can use a [Markdown table generator tool](http://www.tablesgenerator.com/markdown_tables) to help creating them more easily.
196
+
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).
179
197
180
198
## Code
181
199
@@ -184,21 +202,20 @@ sample following the instructions in the [contributing guide](../CONTRIBUTING.md
184
202
185
203
You can include the code using include syntax:
186
204
187
-
```
205
+
```markdown
188
206
[!code-csharp[<title>](<pathToFile>#<RegionName)]
189
207
```
190
208
191
209
The example above shows C# syntax, but other languages are supported.
192
210
Use `code-fsharp` for F# samples; use `code-vbnet` for Visual Basic samples.
193
211
Other languages that are supported are:
194
-
* C++: `code-cpp`
195
-
* HTML: `code-html`
196
-
* JavaScript: `code-javascript`
197
-
* Powershell: `code-ps`
198
-
* SQL: `code-sql`
199
-
* XML: `code-xml`
200
-
201
212
213
+
- C++: `code-cpp`
214
+
- HTML: `code-html`
215
+
- JavaScript: `code-javascript`
216
+
- PowerShell: `code-ps`
217
+
- SQL: `code-sql`
218
+
- XML: `code-xml`
202
219
203
220
The text you place for `<title>` shows up as a rollover on the text. The `<pathToFile>`
204
221
is the path to the source file. The `<RegionName>` should be a region in your source
@@ -217,25 +234,25 @@ int sum = i + j;
217
234
```
218
235
219
236
In other languages, use the comment syntax for that language.
220
-
Finally, you can use line
221
-
numbers: `#L1-L10` would include lines 1 through 10. We discourage line numbers
237
+
238
+
Finally, you can use line numbers: `#L1-L10` would include lines 1 through 10. We discourage line numbers
222
239
because they are very brittle.
223
240
224
241
Including snippets from full programs ensures that all code runs through our Continuous Integration (CI)
225
-
system. However, if you need to show something that causes compile time or
226
-
runtime errors, you can use inline code blocks.
242
+
system. However, if you need to show something that causes compile time or runtime errors, you can
243
+
use inline code blocks.
227
244
228
245
### Inline code blocks with language identifier
229
246
230
247
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).
231
248
232
-
##### C♯
249
+
####C\#
233
250
234
-
```c#
251
+
```csharp
235
252
usingSystem;
236
253
namespaceHelloWorld
237
254
{
238
-
classHello
255
+
classHello
239
256
{
240
257
staticvoidMain()
241
258
{
@@ -248,13 +265,15 @@ namespace HelloWorld
248
265
}
249
266
}
250
267
```
268
+
251
269
#### Python
252
270
253
271
```python
254
272
friends = ['john', 'pat', 'gary', 'michael']
255
273
for i, name inenumerate(friends):
256
274
print"iteration {iteration} is {name}".format(iteration=i, name=name)
Use three backticks (```) for generic code block coding.
288
+
Use three backticks (```) for generic code block coding.
270
289
271
290
> The recommended approach is to use code blocks with language identifiers as explained in the previous section to ensure the proper syntax highlighting in the documentation site. Use generic code blocks only when necessary.
272
291
273
-
```
292
+
```javascript
274
293
functionfancyAlert(arg) {
275
294
if(arg) {
276
295
$.docs({div:'#foo'})
@@ -280,7 +299,7 @@ function fancyAlert(arg) {
280
299
281
300
### Inline code
282
301
283
-
Use backticks (`) for `inline code`. Use inline code for command-line commands, database table and column names, and language keywords.
302
+
Use backticks (`) for `inline code`. Use inline code for command-line commands, database table and column names, and language expressions and function names.
284
303
285
304
## Blockquotes
286
305
@@ -294,25 +313,27 @@ Use backticks (`) for `inline code`. Use inline code for command-line comman
294
313
295
314
### Linked Image
296
315
297
-
[](https://dot.net)
316
+
[](https://dot.net)
[
[
328
+
](https://www.youtube.com/watch?v=g2a4W6Q7aRw)
308
329
309
330
## docs.microsoft extensions
310
331
311
332
docs.microsoft provides a few additional extensions to GitHub Flavored Markdown.
312
333
313
334
### Alerts
314
335
315
-
It's important to use the following alert styles so they render with the proper style in the documentation site. However, the rendering engine on GitHub doesn't diferentiate them.
336
+
It's important to use the following alert styles so they render with the proper style in the documentation site. However, the rendering engine on GitHub doesn't differentiate them.
316
337
317
338
#### Note
318
339
@@ -358,4 +379,4 @@ You can see an example of selectors in action at the [Intune docs](https://docs.
You can see an example of step-by-steps in action at the [Advanced Threat Analytics docs](https://docs.microsoft.com/en-us/advanced-threat-analytics/deploy-use/install-ata-step2).
382
+
You can see an example of step-by-steps in action at the [Advanced Threat Analytics docs](https://docs.microsoft.com/en-us/advanced-threat-analytics/deploy-use/install-ata-step2).
0 commit comments