summaryrefslogtreecommitdiffstats
path: root/docs/theme/TocPage.jinja
blob: 754b62446bc598d7435864bbf693e94a4a352aa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{#def page_toc, max_depth=3 #}

{% macro render_sub_items(pages) %}
{%- for section in pages %}
  <li class="indent-{{ section.level }}">
    <a href="#{{ section.id }}"><span>{{ section.name }}</span></a>
  </li>
  {% if section.level <= max_depth -%}
    {{ render_sub_items(section.children) }}
  {%- endif %}
{%- endfor %}
{% endmacro %}

<ul {{ attrs.render(class="cd-toc-page", data_component="TocPage") }}>
{%- for section in page_toc %}
  <li class="indent-{{ section.level }}">
    <a href="#{{ section.id }}"><span>{{ section.name }}</span></a>
  </li>
  {{ render_sub_items(section.children) }}
{%- endfor %}
</ul>