Skip to content

Commit d39bcf7

Browse files
oboukliColin Robertson
authored andcommitted
Update template (MicrosoftDocs#348)
* Update template.md * Clean up template.md * Update template.md Make some formatting changes. Update style details.
1 parent c8a683f commit d39bcf7

1 file changed

Lines changed: 81 additions & 60 deletions

File tree

styleguide/template.md

Lines changed: 81 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
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).
44

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.
66

7-
8-
## Metadata
7+
## Metadata
98

109
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:
1110

@@ -14,8 +13,8 @@ The full metadata block is above (in the [raw Markdown](https://raw.githubuserco
1413
- 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"`).
1514
- **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).
1615
- **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/).
1918

2019
## Basic Markdown, GFM, and special characters
2120

@@ -27,46 +26,60 @@ All basic and GitHub Flavored Markdown (GFM) is supported. For more information
2726
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:
2827

2928
- 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
36+
- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
3137

3238
## File name
3339

3440
File names use the following rules:
35-
* 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-
4241

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.
4348

4449
## Headings
4550

4651
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").
4952

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.
5157

5258
There **must** be only one first-level heading (H1) in your topic, which will be displayed as the on-page title.
5359

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).
5563

5664
Second-level headings will generate the on-page TOC that appears in the "In this article" section underneath the on-page title.
5765

66+
```markdown
5867
### Third-level heading
68+
5969
#### Fourth-level heading
70+
6071
##### Fifth level heading
72+
6173
###### Sixth-level heading
62-
74+
```
75+
6376
## Text styling
6477

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).
6780

68-
**Bold**
69-
Use for UI elements.
81+
**Bold**
82+
Use for UI elements and language keywords.
7083

7184
## Links
7285

@@ -86,47 +99,55 @@ To link to a header in a Markdown file in the same repo, use relative linking +
8699

87100
- Example: [.NET Community](../docs/welcome.md#community)
88101

102+
### Docs Links
103+
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.
105+
106+
- Example: [Universal Windows Platform documentation](/windows/uwp)
107+
89108
### External Links
90109

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.
92111

93-
- Example: [GitHub](http://www.github.com)
112+
- Example: [GitHub](https://www.github.com)
94113

95114
If a URL appears in a Markdown file, it will be transformed into a clickable link.
96115

97-
- Example: http://www.github.com
116+
- Example: https://www.github.com
98117

99118
### Links to APIs
100119

101120
The build system has some extensions that allow us to link to .NET Core APIs without having to use external links.
102121
When linking to an API, you can use its unique identifier (UID) that is auto-generated from the source code.
103122

104123
You can use one of the following syntax:
124+
105125
1. Markdown link: `[link_text](xref:UID)`
106126
2. Auto link: `<xref:UID>`
107127
3. Shorthand form: `@UID`
108128

109129
- Example: `@System.String`
110-
- Example: `[String class](xref:System.String)`
130+
- Example: `[String class](xref:System.String)`
111131

112132
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).
113133

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.
115135
116136
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:
117137
- Example: @System.Threading.Tasks.Task\`1 becomes `@System.Threading.Tasks.Task%601`
118138
- Example: @System.Exception.\#ctor becomes `@System.Exception.%23ctor`
119139

120140
## Lists
121141

142+
Lists should be surrounded by blank lines.
143+
122144
### Ordered lists
123145

124-
1. This
146+
1. This
125147
1. Is
126148
1. An
127149
1. Ordered
128-
1. List
129-
150+
1. List
130151

131152
#### Ordered list with an embedded list
132153

@@ -139,7 +160,6 @@ When the UID contains the special characters \` or \#, the UID value needs to be
139160
1. ordered
140161
1. list
141162

142-
143163
### Unordered Lists
144164

145165
- This
@@ -148,11 +168,10 @@ When the UID contains the special characters \` or \#, the UID value needs to be
148168
- bulleted
149169
- list
150170

171+
#### Unordered list with an embedded list
151172

152-
##### Unordered list with an embedded list
153-
154-
- This
155-
- bulleted
173+
- This
174+
- bulleted
156175
- list
157176
- Mrs. Peacock
158177
- Mr. Green
@@ -162,7 +181,6 @@ When the UID contains the special characters \` or \#, the UID value needs to be
162181
1. Mrs. White
163182
- lists
164183

165-
166184
## Horizontal rule
167185

168186
---
@@ -175,7 +193,7 @@ When the UID contains the special characters \` or \#, the UID value needs to be
175193
| col 2 is | centered | $12 |
176194
| col 1 is default | left-aligned | $1 |
177195

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).
179197

180198
## Code
181199

@@ -184,21 +202,20 @@ sample following the instructions in the [contributing guide](../CONTRIBUTING.md
184202

185203
You can include the code using include syntax:
186204

187-
```
205+
```markdown
188206
[!code-csharp[<title>](<pathToFile>#<RegionName)]
189207
```
190208

191209
The example above shows C# syntax, but other languages are supported.
192210
Use `code-fsharp` for F# samples; use `code-vbnet` for Visual Basic samples.
193211
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-
201212

213+
- C++: `code-cpp`
214+
- HTML: `code-html`
215+
- JavaScript: `code-javascript`
216+
- PowerShell: `code-ps`
217+
- SQL: `code-sql`
218+
- XML: `code-xml`
202219

203220
The text you place for `<title>` shows up as a rollover on the text. The `<pathToFile>`
204221
is the path to the source file. The `<RegionName>` should be a region in your source
@@ -217,25 +234,25 @@ int sum = i + j;
217234
```
218235

219236
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
222239
because they are very brittle.
223240

224241
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.
227244

228245
### Inline code blocks with language identifier
229246

230247
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).
231248

232-
##### C&#9839;
249+
#### C\#
233250

234-
```c#
251+
```csharp
235252
using System;
236253
namespace HelloWorld
237254
{
238-
class Hello
255+
class Hello
239256
{
240257
static void Main()
241258
{
@@ -248,13 +265,15 @@ namespace HelloWorld
248265
}
249266
}
250267
```
268+
251269
#### Python
252270

253271
```python
254272
friends = ['john', 'pat', 'gary', 'michael']
255273
for i, name in enumerate(friends):
256274
print "iteration {iteration} is {name}".format(iteration=i, name=name)
257275
```
276+
258277
#### PowerShell
259278

260279
```powershell
@@ -266,11 +285,11 @@ $Files = Get-Childitem $Directory -recurse -Include *.log `
266285

267286
### Generic code block
268287

269-
Use three backticks (&#96;&#96;&#96;) for generic code block coding.
288+
Use three backticks (&#96;&#96;&#96;) for generic code block coding.
270289

271290
> 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.
272291
273-
```
292+
```javascript
274293
function fancyAlert(arg) {
275294
if(arg) {
276295
$.docs({div:'#foo'})
@@ -280,7 +299,7 @@ function fancyAlert(arg) {
280299

281300
### Inline code
282301

283-
Use backticks (&#96;) for `inline code`. Use inline code for command-line commands, database table and column names, and language keywords.
302+
Use backticks (&#96;) for `inline code`. Use inline code for command-line commands, database table and column names, and language expressions and function names.
284303

285304
## Blockquotes
286305

@@ -294,25 +313,27 @@ Use backticks (&#96;) for `inline code`. Use inline code for command-line comman
294313

295314
### Linked Image
296315

297-
[![alt text for linked image](../images/Logo_DotNet.png)](https://dot.net)
316+
[![alt text for linked image](../images/Logo_DotNet.png)](https://dot.net)
298317

299318
## Videos
300319

301320
### Channel 9
302321

303-
<iframe src="https://channel9.msdn.com/Shows/On-NET/Shipping-NET-Core-RC2--Tools-Preview-1/player" width="960" height="540" allowFullScreen frameBorder="0"></iframe>
322+
[![Larry Osterman - His one interaction with Bill Gates (over DOS networking stack)](https://sec.ch9.ms/ch9/caf5/f8657a22-5b83-47a3-9748-4c1be9fecaf5/Larry-Osterman-His-one-interaction-with-Bill-Gate_960.jpg)
323+
](https://channel9.msdn.com/Blogs/TheChannel9Team/Larry-Osterman-His-one-interaction-with-Bill-Gates-over-DOS-networking-stack)
304324

305325
### YouTube
306326

307-
<iframe width="420" height="315" src="https://www.youtube.com/embed/g2a4W6Q7aRw" frameborder="0" allowfullscreen></iframe>
327+
[![On .NET 2/4/2016 - Scott Hunter](https://img.youtube.com/vi/g2a4W6Q7aRw/0.jpg)
328+
](https://www.youtube.com/watch?v=g2a4W6Q7aRw)
308329

309330
## docs.microsoft extensions
310331

311332
docs.microsoft provides a few additional extensions to GitHub Flavored Markdown.
312333

313334
### Alerts
314335

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.
316337

317338
#### Note
318339

@@ -358,4 +379,4 @@ You can see an example of selectors in action at the [Intune docs](https://docs.
358379
[Pre](../docs/csharp/expression-trees-interpreting.md)
359380
[Next](../docs/csharp/expression-trees-translating.md)
360381

361-
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

Comments
 (0)