Skip to content

Commit f5102f0

Browse files
authored
Clarify code sample language in contributing docs (#38290)
1 parent 50cfe07 commit f5102f0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

contributing/content-markup-reference.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,15 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro
9999

100100
## Code sample syntax highlighting
101101

102-
To render syntax highlighting in command line instructions, we use triple backticks followed by the term `shell`.
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.
103103

104104
### Usage
105105

106106
```shell
107107
git init YOUR_REPO
108108
```
109109

110-
This syntax highlighting renders light text on a dark background, and should be reserved for command line instructions.
111-
112-
Within the command-line 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.
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.
113111

114112
**Copy-able code blocks**
115113

contributing/content-style-guide.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,21 @@ Style your CTAs using the following format.
5656
Keep lines in code samples to about 60 characters, to avoid requiring readers to scroll horizontally in the code block. Locate explanatory text before the code block, rather than using comments inside the code block. See "[Code sample syntax highlighting](./content-markup-reference.md#code-sample-syntax-highlighting)" for more information on the syntax and formatting of code blocks.
5757

5858
Within code blocks:
59+
- Specify the language of the sample after the first code fence. For a list of all supported languages, see [Code languages](/Users/ethanpalm/docs-internal/contributing/content-markup-reference.md).
5960
- Do not use markup before the command output.
6061
- Only use `$` before the command itself if you’re showing the command’s output in the same block.
6162
- If you show a command and the command's output, do not make the code block copyable.
6263
- If your code example includes `{` or `}` that should render, wrap that section in `{% raw %}` `{% endraw %}` to disable Liquid processing for that section.
6364
- 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.
6465
- **Use**:
6566

66-
```
67+
``` YAML
6768
GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
6869
```
6970
7071
- **Avoid**:
7172
72-
```
73+
``` YAML
7374
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7475
```
7576

0 commit comments

Comments
 (0)