{% macro toc(headings, item_id) %}
    {% for heading in headings %}
  1. {{ heading.text | e }} {% if heading.subheadings | length %} {{ toc(heading.subheadings, item_id) }} {% endif %}
  2. {% endfor %}
{% endmacro %} {{ title | e }}