🐛 Rendering exception in export preview mode when custom attribute value has line breaks https://github.com/siyuan-note/siyuan/issues/11453
This commit is contained in:
parent
b1e0335d83
commit
0acc84f285
1 changed files with 9 additions and 1 deletions
|
@ -2166,7 +2166,15 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool,
|
|||
if addTitle {
|
||||
if root, _ := getBlock(id, tree); nil != root {
|
||||
root.IAL["type"] = "doc"
|
||||
title := &ast.Node{Type: ast.NodeHeading, HeadingLevel: 1, KramdownIAL: parse.Map2IAL(root.IAL)}
|
||||
title := &ast.Node{Type: ast.NodeHeading, HeadingLevel: 1}
|
||||
for k, v := range root.IAL {
|
||||
if "type" == k {
|
||||
continue
|
||||
}
|
||||
title.SetIALAttr(k, v)
|
||||
}
|
||||
title.InsertAfter(&ast.Node{Type: ast.NodeKramdownBlockIAL, Tokens: parse.IAL2Tokens(title.KramdownIAL)})
|
||||
|
||||
content := html.UnescapeString(root.Content)
|
||||
title.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(content)})
|
||||
ret.Root.PrependChild(title)
|
||||
|
|
Loading…
Add table
Reference in a new issue