qwik-cms/content/components/toc.njk

19 lines
571 B
Plaintext

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