From a0a71ab7e0610885d2d49e5f2779f389129bfb16 Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Tue, 29 Nov 2016 23:45:23 +0100 Subject: [PATCH] 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 `` 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 --- docs/config/templates/ngdoc/api/api.template.html | 2 +- docs/config/templates/ngdoc/lib/methods.template.html | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/config/templates/ngdoc/api/api.template.html b/docs/config/templates/ngdoc/api/api.template.html index 97119640411e..3d93e863af17 100644 --- a/docs/config/templates/ngdoc/api/api.template.html +++ b/docs/config/templates/ngdoc/api/api.template.html @@ -51,7 +51,7 @@

Dependencies

{% block examples %} {%- if doc.examples %} -

Example

+

Examples

{%- for example in doc.examples -%} {$ example | marked $} {%- endfor -%} diff --git a/docs/config/templates/ngdoc/lib/methods.template.html b/docs/config/templates/ngdoc/lib/methods.template.html index 49977b3eca6e..47aff128bd91 100644 --- a/docs/config/templates/ngdoc/lib/methods.template.html +++ b/docs/config/templates/ngdoc/lib/methods.template.html @@ -26,6 +26,13 @@

Returns

{$ lib.typeInfo(method.returns) $} {% endif %} + {%- if method.examples %} +

Examples

+ {%- for example in method.examples -%} + {$ example | marked $} + {%- endfor -%} + {% endif -%} + {% endfor -%}