Skip to content
Anton edited this page Aug 3, 2019 · 3 revisions

When there this a need to present some data in a repeatable format, macros can be used. First, a macro needs to be defined with the MACRO rule, and then referenced by the USE-MACRO rule.

<!-- Define a macro -->
%MACRO example
<details>
<summary>$1</summary>

NPM: _[$1](https://nodejs.tools/$2)_
GitHub: _[$1](https://github.com/artdecocode/$2)_
</details>
%

<!-- Now use the macro! -->
%USE-MACRO example
<data>Documentary</data>
<data>documentary</data>
%

%USE-MACRO example
<data>Zoroaster</data>
<data>zoroaster</data>
%
<details>
<summary>Documentary</summary>

NPM: _[Documentary](https://nodejs.tools/documentary)_
GitHub: _[Documentary](https://github.com/artdecocode/documentary)_
</details>

<details>
<summary>Zoroaster</summary>

NPM: _[Zoroaster](https://nodejs.tools/zoroaster)_
GitHub: _[Zoroaster](https://github.com/artdecocode/zoroaster)_
</details>

The data will be substituted with into $N placeholders using the <data> elements found.

Documentary

NPM: Documentary GitHub: Documentary

Zoroaster

NPM: Zoroaster GitHub: Zoroaster


Currently, a macro can only be defined in the same file as its usage. Also, in future, macros will improve my allowing to use named placeholders.

Clone this wiki locally