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:
Martin Staffa
2016-12-01 16:11:25 +01:00
committed by GitHub
parent 9c2d0b8af3
commit f5d2bf3d6e
2 changed files with 8 additions and 1 deletions
@@ -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>