This commit is contained in:
Liang Ding 2022-09-20 11:38:36 +08:00
parent aaedbb2a7f
commit 3a43c97684
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 12 additions and 0 deletions

View file

@ -402,7 +402,13 @@ func resolveRefContent0(node *ast.Node, anchors *map[string]string, depth *int,
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent: ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
buf.Write(n.Tokens) buf.Write(n.Tokens)
case ast.NodeTextMark: case ast.NodeTextMark:
if n.IsTextMarkType("tag") {
buf.WriteByte('#')
}
buf.WriteString(n.Content()) buf.WriteString(n.Content())
if n.IsTextMarkType("tag") {
buf.WriteByte('#')
}
case ast.NodeBlockRef: case ast.NodeBlockRef:
if anchor := n.ChildByType(ast.NodeBlockRefText); nil != anchor { if anchor := n.ChildByType(ast.NodeBlockRefText); nil != anchor {
buf.WriteString(anchor.Text()) buf.WriteString(anchor.Text())

View file

@ -143,7 +143,13 @@ func NodeStaticContent(node *ast.Node) string {
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock: ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock:
buf.Write(n.Tokens) buf.Write(n.Tokens)
case ast.NodeTextMark: case ast.NodeTextMark:
if n.IsTextMarkType("tag") {
buf.WriteByte('#')
}
buf.WriteString(n.Content()) buf.WriteString(n.Content())
if n.IsTextMarkType("tag") {
buf.WriteByte('#')
}
case ast.NodeBackslash: case ast.NodeBackslash:
buf.WriteByte(lex.ItemBackslash) buf.WriteByte(lex.ItemBackslash)
case ast.NodeBackslashContent: case ast.NodeBackslashContent: