diff options
author | Joe Mooring <joe.mooring@veriphor.com> | 2023-10-08 16:59:36 -0700 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-09 18:42:03 +0200 |
commit | 1b5f78b6b7335b02b6207a637498c4c8817999d1 (patch) | |
tree | b124d86ff9eef7356594eba3d8b5d14008277e87 /markup/tableofcontents/tableofcontents.go | |
parent | d5d0f420d8e900126d1a733ca7a9d751288b8b26 (diff) |
markup/tableofcontents: Return template.HTML from .Fragments.ToHTML
Closes #11545
Diffstat (limited to 'markup/tableofcontents/tableofcontents.go')
-rw-r--r-- | markup/tableofcontents/tableofcontents.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/markup/tableofcontents/tableofcontents.go b/markup/tableofcontents/tableofcontents.go index 5afb36067..9109ba87c 100644 --- a/markup/tableofcontents/tableofcontents.go +++ b/markup/tableofcontents/tableofcontents.go @@ -14,6 +14,7 @@ package tableofcontents import ( + "html/template" "sort" "strings" @@ -131,7 +132,7 @@ func (toc *Fragments) addAt(h *Heading, row, level int) { } // ToHTML renders the ToC as HTML. -func (toc *Fragments) ToHTML(startLevel, stopLevel int, ordered bool) string { +func (toc *Fragments) ToHTML(startLevel, stopLevel int, ordered bool) template.HTML { if toc == nil { return "" } @@ -143,7 +144,7 @@ func (toc *Fragments) ToHTML(startLevel, stopLevel int, ordered bool) string { ordered: ordered, } b.Build() - return b.s.String() + return template.HTML(b.s.String()) } func (toc Fragments) walk(fn func(*Heading)) { |