Table of Contents
+ {% block toc %}{% endblock %} +I want to start off by saying that this article template (as of now) is really fricking shit. @@ -98,5 +103,4 @@
diff --git a/README.md b/README.md index 1a60bc6..f91be65 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ I can *promise* you that there is no malicious code or dependency in this projec The project depends on the following packages (installed when you ran `npm i`): * express (a web server framework) * nunjucks (a templating engine) +* nunjucks-append (an extension that adds more functionality to nunjucks) * chokidar (reload templates if they change on disk) * fs (used for filesystem operations) diff --git a/content/components/toc.njk b/content/components/toc.njk index 86aefe7..5ab3288 100644 --- a/content/components/toc.njk +++ b/content/components/toc.njk @@ -1,19 +1,9 @@ -{% macro header(size, text, tocList) %} - {% set tocList = (tocList.push([size, text]), tocList) %} - +{% macro header(size, text) %} + {% append "toc" %} + {{ text }} + {% endappend %} + <{{ size }}> {{ text }} {{ size }}> -{% endmacro %} - -{% macro generate(tocList) %} -
Table of Contents
- - {% for size, text in tocList %} - {{ text }} - {% endfor %} -I want to start off by saying that this article template (as of now) is really fricking shit. @@ -98,5 +103,4 @@
Table of Contents
+ {% block toc %}{% endblock %} +