Fix html conversion of soft line breaks + rel attr for _blank link targets

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-30 18:37:50 +04:00
parent a461410fed
commit dda6e41102
5 changed files with 91 additions and 6 deletions

View File

@@ -117,6 +117,9 @@ func (c *converter) collectRawHTMLRun(start ast.Node) (run string, next ast.Node
case ast.KindText:
t := ch.(*ast.Text)
buf.Write(t.Segment.Value(c.source))
if t.SoftLineBreak() {
buf.WriteByte(' ')
}
case ast.KindString:
buf.Write(ch.(*ast.String).Value)
default:
@@ -352,6 +355,9 @@ func (c *converter) convertImage(n *ast.Image) ([]Node, error) {
func (c *converter) convertText(n *ast.Text) ([]Node, error) {
content := string(n.Segment.Value(c.source))
if n.SoftLineBreak() {
content += " "
}
if content == "" {
return nil, nil
}