🎨 Add Settings - Search - Index - Asset path Fix https://github.com/siyuan-note/siyuan/issues/8221

This commit is contained in:
Liang Ding 2023-05-10 10:30:05 +08:00
parent 49c5e3be9d
commit 3790507ee2
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
16 changed files with 64 additions and 26 deletions

View file

@ -267,7 +267,10 @@ func initDBConnection() {
db.SetConnMaxLifetime(365 * 24 * time.Hour)
}
var caseSensitive bool
var (
caseSensitive bool
indexAssetPath bool
)
func SetCaseSensitive(b bool) {
caseSensitive = b
@ -278,6 +281,10 @@ func SetCaseSensitive(b bool) {
}
}
func SetIndexAssetPath(b bool) {
indexAssetPath = b
}
func refsFromTree(tree *parse.Tree) (refs []*Ref, fileAnnotationRefs []*FileAnnotationRef) {
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if entering {
@ -701,9 +708,9 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
length = utf8.RuneCountInString(fcontent)
} else if n.IsContainerBlock() {
markdown = treenode.ExportNodeStdMd(n, luteEngine)
content = treenode.NodeStaticContent(n, nil, true)
content = treenode.NodeStaticContent(n, nil, true, indexAssetPath)
fc := treenode.FirstLeafBlock(n)
fcontent = treenode.NodeStaticContent(fc, nil, false)
fcontent = treenode.NodeStaticContent(fc, nil, false, false)
parentID = n.Parent.ID
// 将标题块作为父节点
if h := heading(n); nil != h {
@ -712,7 +719,7 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
length = utf8.RuneCountInString(fcontent)
} else {
markdown = treenode.ExportNodeStdMd(n, luteEngine)
content = treenode.NodeStaticContent(n, nil, true)
content = treenode.NodeStaticContent(n, nil, true, indexAssetPath)
parentID = n.Parent.ID
// 将标题块作为父节点
if h := heading(n); nil != h {