mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 08:30:42 +02:00
🎨 Improve search for emojis in tags https://github.com/siyuan-note/siyuan/issues/15391
This commit is contained in:
parent
211648b95e
commit
16d3b65b2a
2 changed files with 10 additions and 1 deletions
|
@ -2213,9 +2213,12 @@ func getRefSearchIgnoreLines() (ret []string) {
|
||||||
func filterQueryInvisibleChars(query string) string {
|
func filterQueryInvisibleChars(query string) string {
|
||||||
query = strings.ReplaceAll(query, " ", "_@full_width_space@_")
|
query = strings.ReplaceAll(query, " ", "_@full_width_space@_")
|
||||||
query = strings.ReplaceAll(query, "\t", "_@tab@_")
|
query = strings.ReplaceAll(query, "\t", "_@tab@_")
|
||||||
|
query = strings.ReplaceAll(query, string(gulu.ZWJ), "__@ZWJ@__")
|
||||||
query = util.RemoveInvalid(query)
|
query = util.RemoveInvalid(query)
|
||||||
query = strings.ReplaceAll(query, "_@full_width_space@_", " ")
|
query = strings.ReplaceAll(query, "_@full_width_space@_", " ")
|
||||||
query = strings.ReplaceAll(query, "_@tab@_", "\t")
|
query = strings.ReplaceAll(query, "_@tab@_", "\t")
|
||||||
|
query = strings.ReplaceAll(query, "__@ZWJ@__", string(gulu.ZWJ))
|
||||||
|
query = strings.ReplaceAll(query, string(gulu.ZWJ)+"#", "#")
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -667,8 +667,9 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
|
||||||
return
|
return
|
||||||
case ast.NodeTextMark:
|
case ast.NodeTextMark:
|
||||||
typ := treenode.TypeAbbr(n.Type.String()) + " " + n.TextMarkType
|
typ := treenode.TypeAbbr(n.Type.String()) + " " + n.TextMarkType
|
||||||
text := n.Content()
|
text := strings.TrimSuffix(n.Content(), string(gulu.ZWJ))
|
||||||
markdown := treenode.ExportNodeStdMd(n, luteEngine)
|
markdown := treenode.ExportNodeStdMd(n, luteEngine)
|
||||||
|
markdown = strings.ReplaceAll(markdown, string(gulu.ZWJ)+"#", "#")
|
||||||
parentBlock := treenode.ParentBlock(n)
|
parentBlock := treenode.ParentBlock(n)
|
||||||
span := &Span{
|
span := &Span{
|
||||||
ID: ast.NewNodeID(),
|
ID: ast.NewNodeID(),
|
||||||
|
@ -873,6 +874,11 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
|
||||||
content = strings.ReplaceAll(content, editor.Zwsp, "")
|
content = strings.ReplaceAll(content, editor.Zwsp, "")
|
||||||
markdown = strings.ReplaceAll(markdown, editor.Zwsp, "")
|
markdown = strings.ReplaceAll(markdown, editor.Zwsp, "")
|
||||||
|
|
||||||
|
// 剔除标签结尾处的零宽连字符 Improve search for emojis in tags https://github.com/siyuan-note/siyuan/issues/15391
|
||||||
|
fcontent = strings.ReplaceAll(fcontent, string(gulu.ZWJ)+"#", "#")
|
||||||
|
content = strings.ReplaceAll(content, string(gulu.ZWJ)+"#", "#")
|
||||||
|
markdown = strings.ReplaceAll(markdown, string(gulu.ZWJ)+"#", "#")
|
||||||
|
|
||||||
block = &Block{
|
block = &Block{
|
||||||
ID: n.ID,
|
ID: n.ID,
|
||||||
ParentID: parentID,
|
ParentID: parentID,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue