diff options
author | FFRaycoder <nn_201312@163.com> | 2020-06-06 06:14:19 +0300 |
---|---|---|
committer | FFRaycoder <nn_201312@163.com> | 2020-06-06 06:14:19 +0300 |
commit | 2199b2e18b15cbed674ba3c1beb62f40aab27c16 (patch) | |
tree | 19d4cd165820724db372852f3df488150e8ce4ac | |
parent | 18a6d19874d556b48f6810e48310b9203c407529 (diff) |
update toc
-rw-r--r-- | layouts/partials/components/post/toc.html | 16 |
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>
+ {{ $header | plainify | htmlUnescape }}
+ </li>
+ </a>
+ {{ end }}
+ {{ end }}
+ {{ end }}
</ul>
</div>
{{ end }}
|