trim leading newline char on blocks for html

This commit is contained in:
Fikri 2023-06-16 23:49:33 +07:00
parent 2d45490186
commit 0de50d60af
5 changed files with 34 additions and 1 deletions

View file

@ -622,7 +622,8 @@ func (w *HTMLWriter) blockContent(name string, children []Node) string {
WriteNodes(w, children...)
out := w.String()
w.Builder, w.htmlEscape = builder, htmlEscape
return strings.TrimRightFunc(out, unicode.IsSpace)
return strings.TrimRightFunc(strings.TrimLeftFunc(out, IsNewLineChar), unicode.IsSpace)
} else {
return w.WriteNodesAsString(children...)
}