qwik-cms/content/components/toc.njk

13 lines
407 B
Plaintext
Raw Normal View History

{% macro header(size, text, tocList) %}
{% set tocList = (tocList.push([size, text]), tocList) %}
<a name="{{ text | replace(" ", "-") }}"></a>
<{{ size }}>
{{ text }}
</{{ size }}>
{% endmacro %}
{% macro generate(tocList) %}
{% for size, text in tocList %}
<a href="#{{ text | replace(" ", "-") }}" class="toc-{{ size }}">{{ text }}</a>
{% endfor %}
{% endmacro %}