Move to custom SSG instead of eleventy.
This commit is contained in:
19
docs/renderer/nodes/TableOfContents.njk
Normal file
19
docs/renderer/nodes/TableOfContents.njk
Normal file
@@ -0,0 +1,19 @@
|
||||
{% macro renderHeadings(headings) %}
|
||||
<ul class="pl-4">
|
||||
{% for heading in headings %}
|
||||
<li class="my-4">
|
||||
<a href="#{{ heading.slug }}" class="hover:text-primary-400">{{ heading.text }}</a>
|
||||
{% if heading.children %}
|
||||
{{ renderHeadings(heading.children)}}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render(node, ctx) %}
|
||||
<div class="my-4 font-medium text-2xl">Table of Contents</div>
|
||||
<div class="-ml-3">
|
||||
{{ renderHeadings(ctx.headings) }}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user