Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ThemeTony/hugo-theme-tony.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFFRaycoder <nn_201312@163.com>2020-06-06 06:14:19 +0300
committerFFRaycoder <nn_201312@163.com>2020-06-06 06:14:19 +0300
commit2199b2e18b15cbed674ba3c1beb62f40aab27c16 (patch)
tree19d4cd165820724db372852f3df488150e8ce4ac
parent18a6d19874d556b48f6810e48310b9203c407529 (diff)
update toc
-rw-r--r--layouts/partials/components/post/toc.html16
1 files changed, 15 insertions, 1 deletions
diff --git a/layouts/partials/components/post/toc.html b/layouts/partials/components/post/toc.html
index 191519f..7599abb 100644
--- a/layouts/partials/components/post/toc.html
+++ b/layouts/partials/components/post/toc.html
@@ -16,7 +16,21 @@
</h4>
</div>
<ul id="article-index" class="index-ul">
- {{ .TableOfContents }}
+ {{ range $headers }}
+ {{ $header := . }}
+ {{ range first 1 (findRE $re $header 1) }}
+ {{ range findRE $renum . 1 }}
+ {{ $next_heading := (cond (eq $h1_n 0) (sub (int .) 1 ) (int . ) ) }}
+ {{ $anchorId := (replaceRE ".* id=\"(.*?)\".*" "$1" $header ) }}
+ <a href="#{{ $anchorId }}">
+ <li style="padding-left:23px" class="">
+ <i class="ri-checkbox-blank-circle-line"></i>
+ &nbsp;&nbsp;{{ $header | plainify | htmlUnescape }}
+ </li>
+ </a>
+ {{ end }}
+ {{ end }}
+ {{ end }}
</ul>
</div>
{{ end }}