From 371062efdbbdd7a80013409211b29fad4f745cf9 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 19 Sep 2022 09:22:47 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8F=98=E6=88=90=E4=BA=86=E6=9C=AA=E5=BC=95=E7=94=A8=E8=B5=84?= =?UTF-8?q?=E6=BA=90=20Fix=20https://github.com/siyuan-note/insider/issues?= =?UTF-8?q?/1048?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/assets.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 23aa82e12..622804dce 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -685,7 +685,8 @@ func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) { ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { // 修改以下代码时需要同时修改 database 构造行级元素实现,增加必要的类型 if !entering || (ast.NodeLinkDest != n.Type && ast.NodeHTMLBlock != n.Type && ast.NodeInlineHTML != n.Type && - ast.NodeIFrame != n.Type && ast.NodeWidget != n.Type && ast.NodeAudio != n.Type && ast.NodeVideo != n.Type) { + ast.NodeIFrame != n.Type && ast.NodeWidget != n.Type && ast.NodeAudio != n.Type && ast.NodeVideo != n.Type && + !n.IsTextMarkType("a")) { return ast.WalkContinue } @@ -696,6 +697,13 @@ func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) { dest := strings.TrimSpace(string(n.Tokens)) ret = append(ret, dest) + } else if n.IsTextMarkType("a") { + if !isRelativePath(gulu.Str.ToBytes(n.TextMarkAHref)) { + return ast.WalkContinue + } + + dest := strings.TrimSpace(n.TextMarkAHref) + ret = append(ret, dest) } else { if ast.NodeWidget == n.Type { dataAssets := n.IALAttr("custom-data-assets")