🎨 导出 Markdown 时引用的超级块转脚注移除超级块标记符 Fix https://github.com/siyuan-note/siyuan/issues/6777

This commit is contained in:
Liang Ding 2022-12-04 12:13:51 +08:00
parent fc9c654269
commit 3b73f3aa9f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -1223,18 +1223,21 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re
}
}
if ast.NodeParagraph == n.Type {
switch n.Type {
case ast.NodeParagraph:
if nil == n.FirstChild {
// 空的段落块需要补全文本展位,否则后续格式化后再解析树会语义不一致 https://github.com/siyuan-note/siyuan/issues/5806
emptyParagraphs = append(emptyParagraphs, n)
}
}
if expandKaTexMacros && (ast.NodeInlineMathContent == n.Type || ast.NodeMathBlockContent == n.Type || (ast.NodeTextMark == n.Type && n.IsTextMarkType("inline-math"))) {
case ast.NodeInlineMathContent, ast.NodeMathBlockContent:
if expandKaTexMacros {
processKaTexMacros(n)
}
if ast.NodeWidget == n.Type {
case ast.NodeTextMark:
if expandKaTexMacros && n.IsTextMarkType("inline-math") {
processKaTexMacros(n)
}
case ast.NodeWidget:
// 挂件块导出 https://github.com/siyuan-note/siyuan/issues/3834 https://github.com/siyuan-note/siyuan/issues/6188
if wysiwyg {
@ -1262,12 +1265,16 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re
}
unlinks = append(unlinks, n)
}
return ast.WalkContinue
case ast.NodeSuperBlockOpenMarker, ast.NodeSuperBlockLayoutMarker, ast.NodeSuperBlockCloseMarker:
if !wysiwyg {
unlinks = append(unlinks, n)
}
}
if ast.NodeText != n.Type {
return ast.WalkContinue
}
// Shift+Enter 换行在导出为 Markdown 时使用硬换行 https://github.com/siyuan-note/siyuan/issues/3458
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\n"), []byte(" \n"))
return ast.WalkContinue