🐛 渲染虚拟引用和搜索高亮导致 Markdown 标记符重复解析 Fix https://github.com/siyuan-note/siyuan/issues/6352

This commit is contained in:
Liang Ding 2022-10-25 20:16:32 +08:00
parent ddfc69df03
commit 2f54fc0b8a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 7 additions and 0 deletions

View file

@ -32,6 +32,7 @@ import (
"github.com/88250/gulu"
"github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/88250/lute/lex"
"github.com/88250/lute/parse"
"github.com/88250/lute/render"
"github.com/siyuan-note/filelock"
@ -186,6 +187,7 @@ func GetDocHistoryContent(historyPath, keyword string) (id, rootID, content stri
n.Tokens = gulu.Str.ToBytes(text)
if bytes.Contains(n.Tokens, []byte("search-mark")) {
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\"+searchMarkSpanStart), []byte("\\\\"+searchMarkSpanStart))
n.Tokens = lex.EscapeMarkers(n.Tokens)
linkTree := parse.Inline("", n.Tokens, luteEngine.ParseOptions)
var children []*ast.Node
for c := linkTree.Root.FirstChild.FirstChild; nil != c; c = c.Next {