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: content/contributing/writing-for-github-docs/style-guide.md
+28-12Lines changed: 28 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,10 @@ Keep lines in code samples to about 60 characters, to avoid requiring readers to
86
86
87
87
Within code blocks:
88
88
- Specify the language of the sample after the first code fence. For a list of all supported languages, see "[Code languages](https://github.com/github/docs/blob/main/data/variables/code-languages.yml)" in the `github/docs` repository.
89
-
- Do not use markup before the command output.
89
+
- Do not use HTML to style or markup a code block.
90
+
- Style any placeholders that people need to replace with their own values in all caps.
91
+
-**Use:**`git checkout -b BRANCH-NAME`
92
+
-**Avoid:**`git checkout -b <branch-name>`
90
93
- Only use `$` before the command itself if you’re showing the command’s output in the same block.
91
94
- If you show a command and the command's output, do not make the code block copyable.
92
95
- If your code example includes `{` or `}` that should render, wrap that section in <code>{% raw %}</code> <code>{% endraw %}</code> to disable Liquid processing for that section.
- If your code example includes content that should be parsed (for example, HTML tags to format text), wrap that section in `<pre>``</pre>` tags to parse rather than escape the content in the section.
108
+
- If your code example includes content that should be parsed, wrap that section in `<pre>``</pre>` tags to parse rather than escape the content in the section.
106
109
107
110
### Commands
108
111
@@ -375,12 +378,12 @@ This text is only an example. Always use the license text from the project you a
375
378
`````
376
379
## Legal notice
377
380
378
-
Portions have been adapted from [PROJECT](/link/to/project) under the MIT license:
381
+
Portions have been adapted from [PROJECT](/LINK/TO/PROJECT) under the MIT license:
379
382
380
383
```
381
384
MIT License
382
385
383
-
Copyright <YEAR> <COPYRIGHTHOLDER>
386
+
Copyright YEARCOPYRIGHT-HOLDER
384
387
385
388
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
386
389
@@ -403,13 +406,13 @@ For any link that points to another {% data variables.product.prodname_docs %} p
403
406
404
407
Usage examples:
405
408
406
-
- For links to other pages: `For more information, see "[AUTOTITLE](/path/to/page)."`
407
-
- For links to sections in other pages: `For more information, see "[AUTOTITLE](/path/to/page#section-link)."`
408
-
- For links to a page with a tool selected: `For more information, see the TOOLNAME documentation in "[AUTOTITLE](/path/to/page?tool=TOOLNAME)."`
409
+
- For links to other pages: `For more information, see "[AUTOTITLE](/PATH/TO/PAGE)."`
410
+
- For links to sections in other pages: `For more information, see "[AUTOTITLE](/PATH/TO/PAGE#SECTION-LINK)."`
411
+
- For links to a page with a tool selected: `For more information, see the TOOLNAME documentation in "[AUTOTITLE](/PATH/TO/PAGE?tool=TOOLNAME)."`
409
412
410
-
Same-page section links do **not** work with `AUTOTITLE`. Instead, type out the full header text: `For more information, see "[Header text](#section-link)."`
413
+
Same-page section links do **not** work with `AUTOTITLE`. Instead, type out the full header text: `For more information, see "[HEADER-TITLE](#SECTION-LINK)."`
411
414
412
-
For links to external documentation, type out the full article name: `For more information, see [Page or article title](https://some-docs.com/path/to/page) in the X documentation.`
415
+
For links to external documentation, type out the full article name: `For more information, see [PAGE-TITLE](https://some-docs.com/PATH/TO/PAGE) in the XYZ documentation.`
413
416
414
417
Do not include quotation marks within a hyperlink.
415
418
@@ -464,12 +467,12 @@ For more information, see "[HEADER TITLE](#HEADER-TITLE)."
464
467
To link to a specific header in a different article, use this format:
465
468
466
469
```
467
-
For more information, see "[AUTOTITLE](path-to-article#HEADER-TITLE)."
470
+
For more information, see "[AUTOTITLE](PATH-TO-ARTICLE#HEADER-TITLE)."
468
471
```
469
472
470
473
To link to two or more specific headers in a different article, use this format:
471
474
```
472
-
For more information, see "[HEADER1](path-to-article#HEADER-1)" and "[HEADER2](path-to-article#HEADER-2)" in "ARTICLETITLE."
475
+
For more information, see "[HEADER-TITLE-1](PATH-TO-ARTICLE#SECTION-LINK-1)" and "[HEADER-TITLE-2](PATH-TO-ARTICLE#SECTION-LINK-2)" in "ARTICLE-TITLE."
473
476
```
474
477
475
478
### Links to a specific tool
@@ -509,6 +512,19 @@ Formatting unordered lists:
509
512
510
513
When introducing a list, avoid phrasing like “the following” or “these”, terms which are difficult to localize. Instead, be descriptive, yet general enough to allow a list to scale or change without having to update the description.
511
514
515
+
## Placeholders
516
+
517
+
Style any placeholder text in all caps. If a placeholder is multiple words, connect the words with dashes (kebab-case). If you use a placeholder, explain what someone might replace it with. This helps people modify examples to fit their needs and helps identify placeholders for people who use assistive technology.
518
+
519
+
**Use:**
520
+
- In the following example, replace YOUR-REPOSITORY with the name of your repository. `git init YOUR-REPOSITORY`
521
+
- Click **Add USERNAME.** Where USERNAME is the username of the person you want to add.
522
+
523
+
**Avoid:**
524
+
- `git init your repository`
525
+
- `git init <your-repository>`
526
+
- Click **Add _username_.**
527
+
512
528
## Procedural steps
513
529
514
530
Procedures give readers a set of sequential steps to follow to complete a task. Always use numbered lists for procedures. Give readers all of the prerequisites or conceptual information they’ll need to complete the task before the procedure, rather than including it within a specific step.
@@ -1114,7 +1130,7 @@ Use bold to describe UI elements that can be interacted with.
Copy file name to clipboardExpand all lines: contributing/content-markup-reference.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,13 +101,17 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro
101
101
102
102
To render syntax highlighting in command line instructions, we use triple backticks followed by the language of the sample. For a list of all supported languages, see the [Code languages](https://github.com/github/docs/blob/main/data/variables/code-languages.yml) file.
103
103
104
+
Do not use HTML to style or modify code samples.
105
+
104
106
### Usage
105
107
106
108
```shell
107
-
git init YOUR_REPO
109
+
git init YOUR-REPO
108
110
```
109
111
110
-
Within the code sample syntax, use all uppercase text to indicate placeholder text or content that varies for each user, such as a user or repository name. By default, codeblocks will escape the content within the triple backticks. If you need to write sample code that parses the content (for example, to italicize text within `<em>` tags instead of passing the tags through literally), wrap the codeblock in `<pre>``</pre>` tags.
112
+
Within the code sample syntax, use all uppercase text to indicate placeholder text or content that varies for each user, such as a user or repository name. Introduce and explain any placeholders before the code sample so that people know what to replace the placeholder text with and because screen readers may not differentiate between upper and lowercase text, so placeholders may not be immediately apparent when read aloud. For example, "In the following example, replace `YOUR-USERNAME` with your GitHub username."
113
+
114
+
By default, codeblocks will escape the content within the triple backticks. If you need to write sample code that parses the content, wrap the codeblock in `<pre>``</pre>` tags.
111
115
112
116
**Copy-able code blocks**
113
117
@@ -123,8 +127,8 @@ Octicons are icons used across GitHub’s interface. We reference octicons when
123
127
124
128
If you're referencing an octicon that appears in the UI, identify whether the octicon is the entire label of the UI element (e.g., a button that is labeled only with "+") or whether it's only decorative, in addition to another label (e.g., a button is labeled "+ Add message").
125
129
126
-
- If the octicon is the entire label, use your browser's developer tools to inspect the octicon and determine what screen reader users will hear instead. Then, use that text for the `aria-label` (e.g., `{% octicon "plus" aria-label="Add file" %}`). Occasionally, in the UI, the octicon itself will not have an `aria-label`, but a surrounding element such as a `<summary>` or `<div>` tag will.
127
-
- If the octicon is decorative, it's likely hidden to screen readers with the `aria-hidden=true` attribute. If so, for consistency with the product, use `aria-hidden="true"` in the Liquid syntax for the octicon in the docs as well (e.g., `"{% octicon "plus" aria-hidden="true" %} Add message"`).
130
+
- If the octicon is the entire label, use your browser's developer tools to inspect the octicon and determine what screen reader users will hear instead. Then, use that text for the `aria-label` (e.g., `{% octicon "plus" aria-label="Add file" %}`). Occasionally, in the UI, the octicon itself will not have an `aria-label`, but a surrounding element such as a `<summary>` or `<div>` tag will.
131
+
- If the octicon is decorative, it's likely hidden to screen readers with the `aria-hidden=true` attribute. If so, for consistency with the product, use `aria-hidden="true"` in the Liquid syntax for the octicon in the docs as well (e.g., `"{% octicon "plus" aria-hidden="true" %} Add message"`).
128
132
129
133
If you're using the octicon in another way, such as using the "check" and "x" icons to reflect binary values in tables, use the `aria-label` to describe the meaning of the octicon, not its visual characteristics. For example, if you're using a "x" icon in the "Supported" column of a table, use "Not supported" as the `aria-label`. For more information, see [Tables](./content-style-guide.md#use-clear-consistent-symbols-and-labels) in the style guide.
0 commit comments