From d58cae9051c1c00abb712b55b273a4282d3d3eaa Mon Sep 17 00:00:00 2001 From: FromEndWorld Date: Thu, 25 Jul 2019 21:38:29 +1200 Subject: [PATCH] Update toc.html --- _includes/toc.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_includes/toc.html b/_includes/toc.html index 67bbdd255..124431f6a 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -41,6 +41,7 @@ {% continue %} {% endif %} + {% assign lastHeaderLevel = headerLevel %} {% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %} {% if headerLevel < minHeader or headerLevel > maxHeader %} @@ -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: '