Skip to content

Commit bf2810d

Browse files
committed
chore: fix fragment partial
1 parent bb74bd9 commit bf2810d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/layouts/_partials/utils/fragments.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
{{ else }}
1313
{{ $headingKeys = $headingKeys | append (printf "%s#%s" $h1.ID $h1.Title) }}
1414
{{ end }}
15-
{{ $headingTitles = $headingTitles | append (printf "# %s" $h1.Title) }}
15+
{{ $headingTitles = $headingTitles | append (printf "<h1>%s" $h1.Title) }}
1616

1717
{{ range $h2 := $h1.Headings }}
1818
{{ $headingKeys = $headingKeys | append (printf "%s#%s" $h2.ID $h2.Title) }}
19-
{{ $headingTitles = $headingTitles | append (printf "## %s" $h2.Title) }}
19+
{{ $headingTitles = $headingTitles | append (printf "<h2>%s" $h2.Title) }}
2020
{{ end }}
2121
{{ end }}
2222

23-
{{ $content := $page.RawContent }}
23+
{{ $content := $page.Content | htmlUnescape }}
2424
{{ $len := len $headingKeys }}
2525
{{ $data := dict }}
2626

@@ -36,14 +36,14 @@
3636
{{ $headingTitle := index $headingTitles $i }}
3737

3838
{{ if eq $i 0 }}
39-
{{ $data = $data | merge (dict $headingKey ($content | $page.RenderString | plainify | htmlUnescape | chomp)) }}
39+
{{ $data = $data | merge (dict $headingKey ($content | plainify | htmlUnescape | chomp)) }}
4040
{{ else }}
41-
{{ $parts := split $content (printf "\n%s\n" $headingTitle) }}
41+
{{ $parts := split $content (printf "%s" $headingTitle) }}
4242
{{ $lastPart := index $parts (sub (len $parts) 1) }}
4343

44-
{{ $data = $data | merge (dict $headingKey ($lastPart | $page.RenderString | plainify | htmlUnescape | chomp)) }}
44+
{{ $data = $data | merge (dict $headingKey ($lastPart | plainify | htmlUnescape | chomp)) }}
4545
{{ $content = strings.TrimSuffix $lastPart $content }}
46-
{{ $content = strings.TrimSuffix (printf "\n%s\n" $headingTitle) $content }}
46+
{{ $content = strings.TrimSuffix (printf "%s" $headingTitle) $content }}
4747
{{ end }}
4848
{{ end }}
4949
{{ end }}

0 commit comments

Comments
 (0)