Commit Graph

2 Commits

Author SHA1 Message Date
Peter Bacon Darwin 447e534350 build(aio): render ALL code-examples, not just the first 2017-03-28 10:21:46 +01:00
Peter Bacon Darwin 1616cae5cf build(aio): add renderExamples processor
This processor will eventually replace the `{@example}` inline tags
because it provides a cleaner approach that also supports tabbed examples
straight out of the box.

The idea is that authors will simply add a `path` and (optionally) a `region`
attribute to `<code-example>` or `<code-pane>` elements in their docs.
This indicates to dgeni that the relevant example needs to be injected
into the content of this element.

For example, assume that there is an example file `toh-pt1/index.hml` with
a region called `title`, which looks like:

```
<h1>Tour of Heroes</h1>
```

Then the document author could get this to appear in the docs as a
standalone example:

```
<code-example path="toh-pt1" region="title"></code-example>
```

Or as part of a tabbed group:

```
<code-tabs>
  <code-pane path="toh-pt1" region="title"></code-pane>
</code-tabs>
```

If no `path` attribute is provided then the element is ignored, which
enables authors to provide inline code instead:

```
<code-example>
 Some &lt;html&gt escaped code
</code-example>
```

Also all attributes other than `path` and `region` are ignored and passed
through to the final rendered output allowing the author to provide
styling hints:

```
<code-example path="toh-pt1" region="title" linenums"15" class="important">
</code-example>
```
2017-03-25 21:32:30 +00:00