Skip to content

Commit

Permalink
Update toc.html
Browse files Browse the repository at this point in the history
  • Loading branch information
FromEndWorld committed Jul 25, 2019
1 parent 2b522cf commit d58cae9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _includes/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
{% continue %}
{% endif %}

{% assign lastHeaderLevel = headerLevel %}
{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}

{% if headerLevel < minHeader or headerLevel > maxHeader %}
Expand All @@ -52,7 +53,14 @@
{% assign minHeader = headerLevel %}
{% endif %}

{% assign lastIndent = indentAmount %}
{% assign indentAmount = headerLevel | minus: minHeader | add: 1 %}
{% if lastHeaderLevel and lastHeaderLevel == headerLevel %}
{% assign indentAmount = lastIndent %}
{% elsif lastIndent and lastIndent < indentAmount %}
{% assign indentAmount = lastIndent | plus: 1 %}
{% endif %}

{% assign _workspace = node | split: '</h' %}

{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
Expand Down

0 comments on commit d58cae9

Please sign in to comment.