feat: add table of contents to blog posts
This commit is contained in:
parent
05748fd193
commit
dbaca137f7
|
@ -0,0 +1,3 @@
|
|||
<a name="{{ text|lower|replace({ ' ': '-' }) }}"></a>
|
||||
|
||||
<h2>{{ text }}</h2>
|
|
@ -0,0 +1,9 @@
|
|||
{% if toc %}
|
||||
<ul>
|
||||
{% for title in toc %}
|
||||
<li>
|
||||
<a href="#{{ title|lower|replace({ ' ': '-' }) }}">{{ title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
|
@ -16,6 +16,8 @@
|
|||
</div>
|
||||
|
||||
<div class="markdown">
|
||||
{% include "post/table-of-contents" with { toc: page.toc } only %}
|
||||
|
||||
{{ parent() }}
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue