Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
d349f897c9
4 changed files with 40 additions and 5 deletions
2
app/stage/protyle/js/lute/lute.min.js
vendored
2
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/88250/clipboard v0.1.5
|
||||
github.com/88250/css v0.1.2
|
||||
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798
|
||||
github.com/88250/lute v1.7.5-0.20221228064057-0c7be092096b
|
||||
github.com/88250/lute v1.7.5-0.20221228082840-f51571fe01c5
|
||||
github.com/88250/pdfcpu v0.3.13
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732
|
||||
|
|
|
@ -21,6 +21,10 @@ github.com/88250/lute v1.7.5-0.20221218043446-d967dba6874e h1:W9QP3v4GnZZkwKln5j
|
|||
github.com/88250/lute v1.7.5-0.20221218043446-d967dba6874e/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
|
||||
github.com/88250/lute v1.7.5-0.20221228064057-0c7be092096b h1:GtIZfyOZagH+2UYEkBprh+cqJhjqTkLnVhAjkI397fc=
|
||||
github.com/88250/lute v1.7.5-0.20221228064057-0c7be092096b/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
|
||||
github.com/88250/lute v1.7.5-0.20221228075634-633aed35b3a7 h1:NjYTH2y9xTjp4+PmZmiPajvS530iopaq2i9d19B1cJU=
|
||||
github.com/88250/lute v1.7.5-0.20221228075634-633aed35b3a7/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
|
||||
github.com/88250/lute v1.7.5-0.20221228082840-f51571fe01c5 h1:TAfGEgAW0OMzwNIxvhnNrpwTgmKyQDlBZI8zg1CUqK0=
|
||||
github.com/88250/lute v1.7.5-0.20221228082840-f51571fe01c5/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
|
||||
github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q=
|
||||
github.com/88250/pdfcpu v0.3.13/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
@ -878,7 +878,7 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markS
|
|||
if ast.NodeText == n.Type {
|
||||
text = search.EncloseHighlighting(text, keywords, getMarkSpanStart(markSpanDataType), getMarkSpanEnd(), Conf.Search.CaseSensitive)
|
||||
n.Tokens = gulu.Str.ToBytes(text)
|
||||
if bytes.Contains(n.Tokens, []byte("search-mark")) {
|
||||
if bytes.Contains(n.Tokens, []byte(searchMarkDataType)) {
|
||||
n.Tokens = lex.EscapeMarkers(n.Tokens)
|
||||
linkTree := parse.Inline("", n.Tokens, luteEngine.ParseOptions)
|
||||
var children []*ast.Node
|
||||
|
@ -892,8 +892,39 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markS
|
|||
return true
|
||||
}
|
||||
} else if ast.NodeTextMark == n.Type {
|
||||
// TODO 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745
|
||||
|
||||
// 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745
|
||||
if n.IsTextMarkType("inline-math") || n.IsTextMarkType("inline-memo") {
|
||||
return false
|
||||
}
|
||||
|
||||
startTag := getMarkSpanStart(markSpanDataType)
|
||||
text = search.EncloseHighlighting(text, keywords, startTag, getMarkSpanEnd(), Conf.Search.CaseSensitive)
|
||||
if strings.Contains(text, searchMarkDataType) {
|
||||
dataType := getMarkSpanStart(n.TextMarkType + " " + searchMarkDataType)
|
||||
text = strings.ReplaceAll(text, startTag, dataType)
|
||||
tokens := gulu.Str.ToBytes(text)
|
||||
linkTree := parse.Inline("", tokens, luteEngine.ParseOptions)
|
||||
var children []*ast.Node
|
||||
for c := linkTree.Root.FirstChild.FirstChild; nil != c; c = c.Next {
|
||||
if ast.NodeText == c.Type {
|
||||
c.Type = ast.NodeTextMark
|
||||
c.TextMarkType = n.TextMarkType
|
||||
c.TextMarkTextContent = string(c.Tokens)
|
||||
}
|
||||
|
||||
children = append(children, c)
|
||||
if nil != n.Next && ast.NodeKramdownSpanIAL == n.Next.Type {
|
||||
c.KramdownIAL = n.KramdownIAL
|
||||
ial := &ast.Node{Type: ast.NodeKramdownSpanIAL, Tokens: n.Next.Tokens}
|
||||
children = append(children, ial)
|
||||
}
|
||||
}
|
||||
for _, c := range children {
|
||||
n.InsertBefore(c)
|
||||
}
|
||||
*unlinks = append(*unlinks, n)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue