chore(doc-gen): render @example tag in ngdoc @method
Currently, ngdoc `@method` ignores `@example` tags and does not output them. This is usually not a problem, as examples are mostly defined directly in the `@description` via code blocks or `<example>` elements. However, some methods still have `@example` tags (possibly from a previous docs version). While not absolutely necessary, having special markup for Examples makes them a) easier to find visually in the docs, and b) easier to link to as they will have a unique id. Closes #14722 Closes #15448
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
|
||||
{% block examples %}
|
||||
{%- if doc.examples %}
|
||||
<h2 id="example">Example</h2>
|
||||
<h2 id="example">Examples</h2>
|
||||
{%- for example in doc.examples -%}
|
||||
{$ example | marked $}
|
||||
{%- endfor -%}
|
||||
|
||||
@@ -26,6 +26,13 @@
|
||||
{$ lib.typeInfo(method.returns) $}
|
||||
{% endif %}
|
||||
|
||||
{%- if method.examples %}
|
||||
<h4 id="{$ doc.name $}.{$ method.name $}-examples">Examples</h4>
|
||||
{%- for example in method.examples -%}
|
||||
{$ example | marked $}
|
||||
{%- endfor -%}
|
||||
{% endif -%}
|
||||
|
||||
</li>
|
||||
{% endfor -%}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user