Skip to content

Commit 6eef4ff

Browse files
committed
Fix links to raw and rendered markdown
1 parent 1a72857 commit 6eef4ff

File tree

1 file changed

+57
-48
lines changed

1 file changed

+57
-48
lines changed

styleguide/template.md

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
# Metadata and Markdown Template for C++ Docs
22

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

55
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

77
## Metadata
88

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:
1010

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 `#`.
1313
- 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.
1818

1919
## Basic Markdown, GFM, and special characters
2020

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:
2222

2323
- [Baseline Markdown syntax](https://daringfireball.net/projects/markdown/syntax)
2424
- [GFM documentation](https://guides.github.com/features/mastering-markdown)
@@ -27,7 +27,7 @@ Markdown uses special characters such as \*, \`, and \# for formatting. If you w
2727

2828
- Put a backslash before the special character to "escape" it (for example, `\*` for a \*)
2929
- 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.
3131

3232
## Markdown editing tools
3333

@@ -41,11 +41,11 @@ You can use [Visual Studio Code](https://code.visualstudio.com/) to edit Markdow
4141
File names use the following rules:
4242

4343
- 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.
4949

5050
## Headings
5151

@@ -54,13 +54,13 @@ Use sentence-style capitalization. Always capitalize:
5454
- The first word of a heading.
5555
- The word following a colon in a title or heading (for example, "How to: Sort an array").
5656

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

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

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# #`.
6262

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

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

@@ -77,30 +77,36 @@ Second-level headings will generate the on-page TOC that appears in the "In this
7777
## Text styling
7878

7979
*Italics*\
80+
\*Italics\*\
8081
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).
8182

8283
**Bold**\
84+
\*\*Bold\*\*\
8385
Use for UI elements.
8486

8587
**`Bold Code`**\
88+
\*\*\`Bold Code\`\*\*\
8689
Use for keywords, operators, and compiler and tool options.
8790

8891
*`Italic Code`*\
92+
\*\`Italic Code\`\*\
8993
Use for parameters.
9094

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

94-
> Blockquote
99+
> Blockquote\
100+
\> Blockquote
95101
96102
Use blockquote for error and warning messages, syntax sections, and EBNF content.
97103

98104
## Links
99105

100106
### Internal Links
101107

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"`.
104110

105111
- Example: [Chapter 1](#chapter-1)
106112

@@ -115,7 +121,7 @@ To link to a header in a Markdown file in the same repo, use relative linking +
115121

116122
### Docs Links
117123

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

120126
- Example: [Universal Windows Platform documentation](/windows/uwp)
121127

@@ -131,10 +137,11 @@ If a URL appears in a Markdown file, it will be transformed into a clickable lin
131137

132138
### Links to APIs
133139

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+
135142
When linking to an API, you can use its unique identifier (UID) that is auto-generated from the source code.
136143

137-
You can use one of the following syntax:
144+
You can use one of the following syntax forms:
138145

139146
1. Markdown link: `[link_text](xref:UID)`
140147
2. Auto link: `<xref:UID>`
@@ -149,7 +156,7 @@ For more information about using this notation, see [Using cross reference](http
149156
150157
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:
151158

152-
- Example: @System.Threading.Tasks.Task\`1 becomes `@System.Threading.Tasks.Task%601`
159+
- Example: `@System.Threading.Tasks.Task\`1` becomes `@System.Threading.Tasks.Task%601`
153160
- Example: @System.Exception.\#ctor becomes `@System.Exception.%23ctor`
154161

155162
## Lists
@@ -158,8 +165,8 @@ Lists should be surrounded by blank lines.
158165

159166
### Ordered lists
160167

161-
1. This
162-
1. Is
168+
1. Example
169+
1. Of
163170
1. An
164171
1. Ordered
165172
1. List
@@ -170,30 +177,30 @@ Lists should be surrounded by blank lines.
170177
1. comes
171178
1. an
172179
1. embedded
173-
1. Miss Scarlett
174-
1. Professor Plum
180+
1. Scarlet
181+
1. Plum
175182
1. ordered
176183
1. list
177184

178185
### Unordered Lists
179186

180-
- This
181-
- is
187+
- Example
188+
- of
182189
- a
183190
- bulleted
184191
- list
185192

186193
#### Unordered list with an embedded list
187194

188-
- This
195+
- Sometimes
189196
- bulleted
190-
- list
191-
- Mrs. Peacock
192-
- Mr. Green
193-
- contains
197+
- lists
198+
- Chartreuse
199+
- Lime
200+
- contain
194201
- other
195-
1. Colonel Mustard
196-
1. Mrs. White
202+
1. Magenta
203+
1. Fuchsia
197204
- lists
198205

199206
## Horizontal rule
@@ -209,7 +216,7 @@ ___
209216
| col 1 is default | left-aligned | $1 |
210217

211218
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.
213220

214221
## Code
215222

@@ -239,7 +246,7 @@ code that should be included. Use the `#region` and `#endregion` preprocessor sy
239246
to specify the region of code to include.
240247

241248
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#:
243250

244251
```csharp
245252
// <CodeToInclude>
@@ -252,15 +259,15 @@ int sum = i + j;
252259
In other languages, use the comment syntax for that language.
253260

254261
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.
256263

257264
Including snippets from full programs ensures that all code runs through our Continuous Integration (CI)
258265
system. However, if you need to show something that causes compile time or runtime errors, you can
259266
use inline code blocks.
260267

261268
### Inline code blocks with language identifier
262269

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

265272
#### C++
266273

@@ -356,16 +363,18 @@ Use backticks (&#96;) for `inline code`. Use inline code for command-line comman
356363
### Shows
357364

358365
[![C++ A General Purpose Language and Library: (01) Getting Started](https://docs.microsoft.com/video/media/e8265f2d-9ea3-4052-99cd-b8cfb246b0f0/clanguagelibrarym01_960.jpg)
359-
](https://docs.microsoft.com/en-us/shows/cplusplus-language-library/01)
366+
](https://docs.microsoft.com/en-us/shows/cplusplus-language-library/01)\
367+
C++ A General Purpose Language and Library: (01) Getting Started.
360368

361369
### YouTube
362370

363371
[![On .NET 2/4/2016 - Scott Hunter.](https://img.youtube.com/vi/g2a4W6Q7aRw/0.jpg)
364-
](https://www.youtube.com/watch?v=g2a4W6Q7aRw)
372+
](https://www.youtube.com/watch?v=g2a4W6Q7aRw)\
373+
On .NET 2/4/2016 - Scott Hunter.
365374

366375
## docs.microsoft extensions
367376

368-
docs.microsoft provides a few additional extensions to GitHub Flavored Markdown.
377+
docs.microsoft provides a few more extensions to GitHub Flavored Markdown.
369378

370379
### Alerts
371380

0 commit comments

Comments
 (0)