diff options
author | Vincent Tam <sere@live.hk> | 2019-08-01 00:27:01 +0300 |
---|---|---|
committer | Vincent Tam <sere@live.hk> | 2019-08-01 00:27:01 +0300 |
commit | 15fc33d78b495dafff7f2c3b78cca628bc3bfc98 (patch) | |
tree | 86da3f59a78eca78300b719aae996a6890c18f7a | |
parent | 68c2a6962ed8ab02239dfaf6179fd54e1e7a15eb (diff) |
Applied @user501254's fix
https://github.com/gohugoio/hugo/issues/1778#issuecomment-483880269
-rw-r--r-- | layouts/_default/single.html | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 24f4dd5..1584dcf 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -49,7 +49,9 @@ {{ if .TableOfContents }} <details> <summary>{{ i18n "toc" }}</summary> - {{- .TableOfContents -}} + {{- $emtLiPtrn := "(?s)<ul>\\s<li>\\s<ul>(.*)</li>\\s</ul>" -}} + {{- $rplcEmtLi := "<ul>$1" -}} + {{ .TableOfContents | replaceRE $emtLiPtrn $rplcEmtLi | safeHTML }} </details> {{- end -}} {{- .Content -}} |