{% capture workspace %} {% assign min = include.min | default: 2 %} {% assign max = include.max | default: 3 %} {% assign nodes = include.html | strip | split: '{% endcapture %} {% elsif lastLevel < level %} {% assign sub = include.sub | default: 'toc-sub-%level%' %} {% assign subLevel = level | minus: 1 %} {% capture output %}{{ output }}<{% if include.ordered %}ol{% else %}ul{% endif %}{% endcapture %} {% capture output %}{{ output }} class="{{ sub | replace: '%level%', subLevel }}">{% endcapture %} {% elsif level < lastLevel %} {% assign count = lastLevel | minus: level %} {% for index in (1..count) %} {% capture output %}{{ output }}{% if include.ordered %}{% else %}{% endif %}{% endcapture %} {% endfor %} {% capture output %}{{ output }}{% endcapture %} {% else %} {% capture output %}{{ output }}{% endcapture %} {% endif %} {% capture a_body_temp %}{{ node | split: '' | first }}>{% endcapture %} {% capture a_body %}{{ a_body_temp | replace: a_body_prev, '' }}{% endcapture %} {% capture a_class %}{{ include.a | default: 'toc-a' }}{% endcapture %} {% capture a_href %}{{ include.base | default: '' }}#{{ title }}{% endcapture %} {% capture a %}{{ a_body | strip_html }}{% endcapture %} {% capture liClass %}{{ include.li | default: 'toc-li-%level%' | replace: '%level%', level }}{% endcapture %} {% capture output %}{{ output }}
  • {{ a }}{% endcapture %} {% assign lastLevel = level %} {% endfor %} {% assign count = lastLevel | minus: min | plus: 1 %} {% for index in (1..count) %} {% capture output %}{{ output }}
  • {% if include.ordered %}{% else %}{% endif %}{% endcapture %} {% endfor %} {% endcapture %} {%- comment -%}{%- endcomment -%} {{ output }} {%- comment -%}{%- endcomment -%}