File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ <h1>{{ page.title }}</h1>
2323 < nav class ="post-toc " aria-label ="Table of contents ">
2424 < p class ="toc-label "> Contents</ p >
2525 < ul >
26- {% assign headings = content | split: '< h2 ' %}
26+ {% assign headings = content | split: '< h2 id =" ' %}
2727 {% for heading in headings %}
28- {% if heading contains 'id="' %}
29- {% assign id = heading | split: 'id="' | last | split: ' "' | first %}
30- {% assign text = heading | split: '> ' | slice: 1 | join: ' > ' | split: '</ h2 > ' | first %}
28+ {% unless forloop.first %}
29+ {% assign id = heading | split: ' "' | first %}
30+ {% assign text = heading | split: '" > ' | last | split: '</ h2 > ' | first %}
3131 < li > < a href ="#{{ id }} "> {{ text | strip_html }}</ a > </ li >
32- {% endif %}
32+ {% endunless %}
3333 {% endfor %}
3434 </ ul >
3535 </ nav >
Original file line number Diff line number Diff line change @@ -451,7 +451,7 @@ main {
451451/* Table of contents */
452452.post-toc {
453453 max-width : 760px ;
454- margin : 0 auto 1.5rem ;
454+ margin : 1 rem auto 1.5rem ;
455455 padding : 1rem 1.25rem ;
456456 border : 1px solid var (--line );
457457 border-radius : var (--radius );
You can’t perform that action at this time.
0 commit comments