Skip to content

Commit 1f3b8ab

Browse files
Update placeholder guidance (#40258)
Co-authored-by: Felicity Chapman <felicitymay@github.com>
1 parent 056cd70 commit 1f3b8ab

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed

content/contributing/writing-for-github-docs/style-guide.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ Keep lines in code samples to about 60 characters, to avoid requiring readers to
8686

8787
Within code blocks:
8888
- 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>`
9093
- Only use `$` before the command itself if you’re showing the command’s output in the same block.
9194
- If you show a command and the command's output, do not make the code block copyable.
9295
- If your code example includes `{` or `}` that should render, wrap that section in <code>&#123% raw %&#125;</code> <code>&#123% endraw %&#125;</code> to disable Liquid processing for that section.
@@ -102,7 +105,7 @@ Within code blocks:
102105
GITHUB_TOKEN: $&#123;&#123; secrets.GITHUB_TOKEN &#125;&#125;
103106
</pre>
104107

105-
- 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.
106109

107110
### Commands
108111

@@ -375,12 +378,12 @@ This text is only an example. Always use the license text from the project you a
375378
`````
376379
## Legal notice
377380

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

380383
```
381384
MIT License
382385
383-
Copyright <YEAR> <COPYRIGHT HOLDER>
386+
Copyright YEAR COPYRIGHT-HOLDER
384387
385388
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:
386389
@@ -403,13 +406,13 @@ For any link that points to another {% data variables.product.prodname_docs %} p
403406

404407
Usage examples:
405408

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)."`
409412

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)."`
411414

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.`
413416

414417
Do not include quotation marks within a hyperlink.
415418

@@ -464,12 +467,12 @@ For more information, see "[HEADER TITLE](#HEADER-TITLE)."
464467
To link to a specific header in a different article, use this format:
465468

466469
```
467-
For more information, see "[AUTOTITLE](path-to-article#HEADER-TITLE)."
470+
For more information, see "[AUTOTITLE](PATH-TO-ARTICLE#HEADER-TITLE)."
468471
```
469472

470473
To link to two or more specific headers in a different article, use this format:
471474
```
472-
For more information, see "[HEADER 1](path-to-article#HEADER-1)" and "[HEADER 2](path-to-article#HEADER-2)" in "ARTICLE TITLE."
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."
473476
```
474477

475478
### Links to a specific tool
@@ -509,6 +512,19 @@ Formatting unordered lists:
509512
510513
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.
511514
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+
512528
## Procedural steps
513529
514530
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.
11141130

11151131
Use code formatting for branch names.
11161132
- `main`
1117-
- `<username>.github.io`
1133+
- `USERNAME.github.io`
11181134

11191135
### Buttons
11201136

contributing/content-markup-reference.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,17 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro
101101

102102
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.
103103

104+
Do not use HTML to style or modify code samples.
105+
104106
### Usage
105107

106108
```shell
107-
git init YOUR_REPO
109+
git init YOUR-REPO
108110
```
109111

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

112116
**Copy-able code blocks**
113117

@@ -123,8 +127,8 @@ Octicons are icons used across GitHub’s interface. We reference octicons when
123127

124128
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").
125129

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"`).
128132

129133
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.
130134

0 commit comments

Comments
 (0)