{% capture tocWorkspace %} {% capture newline %} {% endcapture %} {% assign newline = newline | rstrip %} {% capture deprecation_warnings %}{% endcapture %} {% if include.baseurl %} {% capture deprecation_warnings %}{{ deprecation_warnings }}{{ newline }}{% endcapture %} {% endif %} {% if include.skipNoIDs %} {% capture deprecation_warnings %}{{ deprecation_warnings }}{{ newline }}{% endcapture %} {% endif %} {% capture jekyll_toc %}{% endcapture %} {% assign orderedList = include.ordered | default: false %} {% assign baseURL = include.base_url | default: include.baseurl | default: '' %} {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %} {% assign minHeader = 2 %} {% assign maxHeader = 6 %} {% assign nodes = include.html | strip | split: ' maxHeader %} {% continue %} {% endif %} {% assign _workspace = node | split: '' | first }}>{% endcapture %} {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} {% if include.item_class and include.item_class != blank %} {% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %} {% endif %} {% if include.submenu_class and include.submenu_class != blank %} {% assign subMenuLevel = currLevel | minus: 1 %} {% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %} {% endif %} {% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %} {% if htmlID %} {% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %} {% if include.anchor_class %} {% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %} {% endif %} {% capture listItem %}{{ anchorBody }}{% endcapture %} {% elsif skipNoIDs == true %} {% continue %} {% else %} {% capture listItem %}{{ anchorBody }}{% endcapture %} {% endif %} {% if currLevel > lastLevel %} {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %} {% elsif currLevel < lastLevel %} {% assign repeatCount = lastLevel | minus: currLevel %} {% for i in (1..repeatCount) %} {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} {% endfor %} {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} {% else %} {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} {% endif %} {% capture jekyll_toc %}{{ jekyll_toc }}{{ 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 }}{% endcapture %} {% endfor %} {% if jekyll_toc != '' %} {% assign rootAttributes = '' %} {% if include.class and include.class != blank %} {% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %} {% endif %} {% if include.id and include.id != blank %} {% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %} {% endif %} {% if rootAttributes %} {% assign nodes = jekyll_toc | split: '>' %} {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %} {% endif %} {% endif %} {% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc }}