1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Add note about copyable code blocks to style guide (#35915)

This commit is contained in:
Ethan Palm
2023-03-28 16:28:13 -07:00
committed by GitHub
parent a5c06d7fa0
commit cb52336ab3

View File

@@ -53,11 +53,12 @@ Style your CTAs using the following format.
### Code blocks
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.
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.
Within code blocks:
- Do not use markup before the command output.
- Only use `$` before the command itself if youre showing the commands output in the same block.
- If you show a command and the command's output, do not make the code block copyable.
- If your code example includes `{` or `}` that should render, wrap that section in `{% raw %}` `{% endraw %}` 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.
- **Use**: