Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 93ad990

Browse files
committed
chore(doc-gen): render @example tag for ngdoc @method
Currently, ngdoc @method ignores @example tags. Examples are usually rendered directly into the @description via code blocks or <example> elements. However, some methods still have @example tags (possibly from a previous docs version), which are currently not visible. 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
1 parent f776799 commit 93ad990

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/config/templates/ngdoc/api/api.template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h2 id="dependencies">Dependencies</h2>
5151

5252
{% block examples %}
5353
{%- if doc.examples %}
54-
<h2 id="example">Example</h2>
54+
<h2 id="example">Examples</h2>
5555
{%- for example in doc.examples -%}
5656
{$ example | marked $}
5757
{%- endfor -%}

docs/config/templates/ngdoc/lib/methods.template.html

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ <h4>Returns</h4>
2626
{$ lib.typeInfo(method.returns) $}
2727
{% endif %}
2828

29+
{%- if method.examples %}
30+
<h4 id="{$ doc.name $}.{$ method.name $}-examples">Examples</h4>
31+
{%- for example in method.examples -%}
32+
{$ example | marked $}
33+
{%- endfor -%}
34+
{% endif -%}
35+
2936
</li>
3037
{% endfor -%}
3138
</ul>

0 commit comments

Comments
 (0)