Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve HTML clipping https://github.com/siyuan-note/siyuan/issues/14233

Daniel51fb0ebb2218
diff --git a/kernel/api/extension.go b/kernel/api/extension.go
index 51be0800ab..ca0547aea9 100644
--- a/kernel/api/extension.go
+++ b/kernel/api/extension.go
@@ -238,6 +238,26 @@ func extensionCopy(c *gin.Context) {
if "" != assetPath {
dest.Tokens = []byte(assetPath)
}
+
+ // 检测 alt 和 title 格式,如果不是文本的话转换为文本 https://github.com/siyuan-note/siyuan/issues/14233
+ if linkText := n.ChildByType(ast.NodeLinkText); nil != linkText {
+ if inlineTree := parse.Inline("", linkText.Tokens, luteEngine.ParseOptions); nil != inlineTree && nil != inlineTree.Root && nil != inlineTree.Root.FirstChild {
+ if fc := inlineTree.Root.FirstChild.FirstChild; nil != fc {
+ if ast.NodeText != fc.Type {
+ linkText.Tokens = []byte(fc.Text())
+ }
+ }
+ }
+ }
+ if title := n.ChildByType(ast.NodeLinkTitle); nil != title {
+ if inlineTree := parse.Inline("", title.Tokens, luteEngine.ParseOptions); nil != inlineTree && nil != inlineTree.Root && nil != inlineTree.Root.FirstChild {
+ if fc := inlineTree.Root.FirstChild.FirstChild; nil != fc {
+ if ast.NodeText != fc.Type {
+ title.Tokens = []byte(fc.Text())
+ }
+ }
+ }
+ }
}
}
return ast.WalkContinue