Skip to content

Commit

Permalink
Merge pull request #34 from hakusaro/patch-toc
Browse files Browse the repository at this point in the history
Add workaround for TableOfContents h1/h2 hierarchy issue
  • Loading branch information
qqpann authored Nov 30, 2019
2 parents ab68570 + 1500842 commit 216c469
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@
{{ define "side" }}
{{ if and (gt .WordCount 0 ) (ne .Params.toc "false") }}
<div id="toc" class="Box Box--blue mb-3">
<b>{{.Title}}</b>
{{ .TableOfContents }}
<b>{{ .Title }}</b>
{{- $toc := .TableOfContents -}}
{{- $toc := replaceRE `<nav id="TableOfContents">\n<ul>\n<li>\n<ul>` `<nav id="TableOfContents"><ul>` $toc -}}
{{- $toc := replaceRE `</ul>\n</li>\n</ul>\n</nav>` `</ul>\n</nav>` $toc -}}
{{- safeHTML $toc -}}
</div>
{{ end }}

Expand Down

0 comments on commit 216c469

Please sign in to comment.