html: Fix html writer footnotes (in headlines)
writer.footnotes must be a pointer as we copy the writer in nodesAsString() and can thus end up modifying the footnotes.list slice without it being reflected in the original writer (i.e. when the backing array of the slice changes).
This commit is contained in:
parent
97fe8b7850
commit
f67a251e27
4 changed files with 69 additions and 2 deletions
|
@ -19,7 +19,7 @@ type HTMLWriter struct {
|
|||
HighlightCodeBlock func(source, lang string) string
|
||||
htmlEscape bool
|
||||
log *log.Logger
|
||||
footnotes footnotes
|
||||
footnotes *footnotes
|
||||
}
|
||||
|
||||
type footnotes struct {
|
||||
|
@ -61,7 +61,7 @@ func NewHTMLWriter() *HTMLWriter {
|
|||
HighlightCodeBlock: func(source, lang string) string {
|
||||
return fmt.Sprintf("<div class=\"highlight\">\n<pre>\n%s\n</pre>\n</div>", html.EscapeString(source))
|
||||
},
|
||||
footnotes: footnotes{
|
||||
footnotes: &footnotes{
|
||||
mapping: map[string]int{},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue