docs: emphasize headers for code examples (#32938)

PR Close #32938
This commit is contained in:
Judy Bogart 2019-10-01 09:50:11 -07:00 committed by atscott
parent 32b6548be9
commit 088435c5eb
1 changed files with 3 additions and 0 deletions

View File

@ -322,6 +322,7 @@ The <code class="no-auto-link">item</code> property is `true`.
For block code snippets, we generally prefer to display code with For block code snippets, we generally prefer to display code with
the Angular documentation _code-example_ component represented by the `<code-example>` tag. the Angular documentation _code-example_ component represented by the `<code-example>` tag.
The `<code-example>` tag has a `header` attribute that you use to identify the file that the example comes from. The header should be used whenever possible to establish the context of the example.
See [Code snippets and code examples](guide/docs-style-guide#code-snippets-and-code-samples) for more details. See [Code snippets and code examples](guide/docs-style-guide#code-snippets-and-code-samples) for more details.
<h3 class="no-toc">Inline code-snippets</h3> <h3 class="no-toc">Inline code-snippets</h3>
@ -348,6 +349,8 @@ user input in a command shell or the _output_ of some process.
**Do not write inline code snippets** unless you have a good reason and the editor's permission to do so. **Do not write inline code snippets** unless you have a good reason and the editor's permission to do so.
In all other cases, code snippets should be generated automatically from tested code samples. In all other cases, code snippets should be generated automatically from tested code samples.
For hypothetical examples such as illustrations of configuration options in a JSON file, you should still use The `<code-example>` tag with the `header` attribute to identify the context.
{@a from-code-samples} {@a from-code-samples}
<h3 class="no-toc">Code snippets and code samples</h3> <h3 class="no-toc">Code snippets and code samples</h3>