    {% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}

        {% assign lastLevel = currLevel %}
        {% assign firstHeader = false %}
    {% endfor %}

    {% assign repeatCount = minHeader | minus: 1 %}
    {% assign repeatCount = lastLevel | minus: repeatCount %}
    {% for i in (1..repeatCount) %}
        {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
    {% endfor %}

    {% if jekyll_toc != '' %}
        {% assign root