Fix codeblocks doubled newlines in plaintext mode

This commit is contained in:
n-peugnet 2022-10-10 19:13:30 +02:00
parent 58c20698d6
commit 1cff17a857

View File

@ -312,11 +312,13 @@ func (parser *htmlParser) syntaxHighlight(text, language string) Entity {
continue
}
t := token.Clone()
t.Value = line
children = append(children, tokenToTextEntity(style, &t))
if line[line_len-1:] == "\n" {
children = append(children, NewBreakEntity())
t.Value = line[:line_len-1]
children = append(children, tokenToTextEntity(style, &t), NewBreakEntity())
} else {
t.Value = line
children = append(children, tokenToTextEntity(style, &t))
}
}
}