소스 검색

:sparkles: 支持行级备注 https://github.com/siyuan-note/siyuan/issues/174

Liang Ding 2 년 전
부모
커밋
edfb645f3a
2개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 0 1
      kernel/go.sum
  2. 3 1
      kernel/model/search.go

+ 0 - 1
kernel/go.sum

@@ -604,4 +604,3 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
 sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
-

+ 3 - 1
kernel/model/search.go

@@ -166,8 +166,10 @@ func FindReplace(keyword, replacement string, ids []string) (err error) {
 					n.Tokens = bytes.ReplaceAll(n.Tokens, []byte(keyword), []byte(replacement))
 				}
 			case ast.NodeTextMark:
-				if strings.Contains(n.TextMarkTextContent, keyword) {
+				if strings.Contains(n.TextMarkTextContent, keyword) || strings.Contains(n.TextMarkInlineMathContent, keyword) || strings.Contains(n.TextMarkInlineMemoContent, keyword) {
 					n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
+					n.TextMarkInlineMathContent = strings.ReplaceAll(n.TextMarkInlineMathContent, keyword, replacement)
+					n.TextMarkInlineMemoContent = strings.ReplaceAll(n.TextMarkInlineMemoContent, keyword, replacement)
 				}
 			}
 			return ast.WalkContinue