mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2026-11-22 12:39:04 +00:00
fix(toc): show toc for org mode headings spanning multiple lines
closes #1872
This commit is contained in:
1 file changed
+2
-2
@@ -1,4 +1,4 @@
|
||||
{{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}}
|
||||
{{- $headers := findRE "<h[1-6].*?>(.|\n)+?</h[1-6]>" .Content -}}
|
||||
{{- $has_headers := ge (len $headers) 1 -}}
|
||||
{{- if $has_headers -}}
|
||||
<details class="toc" {{if (.Param "TocOpen") }} open{{ end }}>
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
{{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}}
|
||||
{{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }}
|
||||
{{- $header := replaceRE "<h[1-6].*?>((.|\n])+?)</h[1-6]>" "$1" $header -}}
|
||||
{{- $header := replaceRE "<h[1-6].*?>((.|\n)+?)</h[1-6]>" "$1" $header | strings.TrimSpace -}}
|
||||
|
||||
{{- if ne $i 0 -}}
|
||||
{{- $prevHeaderLevel := index (findRE "[1-6]" (index $headers (sub $i 1)) 1) 0 -}}
|
||||
|
||||
Reference in new issue
Block a user