♻️ 移除旧版中的行级元素实现代码 https://github.com/siyuan-note/siyuan/issues/6819

This commit is contained in:
Liang Ding 2022-12-08 20:19:35 +08:00
parent bc850b331a
commit c69983c56c
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
8 changed files with 20 additions and 51 deletions

View file

@ -943,7 +943,7 @@ func exportMarkdownContent(id string) (hPath, exportedMd string) {
}
func processKaTexMacros(n *ast.Node) {
if ast.NodeInlineMathContent != n.Type && ast.NodeMathBlockContent != n.Type && ast.NodeTextMark != n.Type {
if ast.NodeMathBlockContent != n.Type && ast.NodeTextMark != n.Type {
return
}
if ast.NodeTextMark == n.Type && !n.IsTextMarkType("inline-math") {
@ -1081,7 +1081,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re
case ast.NodeHeading:
n.HeadingNormalizedID = n.IALAttr("id")
n.ID = n.HeadingNormalizedID
case ast.NodeInlineMathContent, ast.NodeMathBlockContent:
case ast.NodeMathBlockContent:
n.Tokens = bytes.TrimSpace(n.Tokens) // 导出 Markdown 时去除公式内容中的首尾空格 https://github.com/siyuan-note/siyuan/issues/4666
return ast.WalkContinue
case ast.NodeTextMark:
@ -1216,7 +1216,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re
// 空的段落块需要补全文本展位,否则后续格式化后再解析树会语义不一致 https://github.com/siyuan-note/siyuan/issues/5806
emptyParagraphs = append(emptyParagraphs, n)
}
case ast.NodeInlineMathContent, ast.NodeMathBlockContent:
case ast.NodeMathBlockContent:
if expandKaTexMacros {
processKaTexMacros(n)
}