Skip to content

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

:art: Improve clipping for ld246.com https://github.com/siyuan-note/siyuan/issues/13117

Daniel255afcc9ad37
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go
index fc0a5346e2..24a2c381f6 100644
--- a/kernel/api/filetree.go
+++ b/kernel/api/filetree.go
@@ -742,8 +742,13 @@ func createDocWithMd(c *gin.Context) {
if nil != withMathArg {
withMath = withMathArg.(bool)
}
+ clippingHref := ""
+ clippingHrefArg := arg["clippingHref"]
+ if nil != clippingHrefArg {
+ clippingHref = clippingHrefArg.(string)
+ }
- id, err := model.CreateWithMarkdown(tags, notebook, hPath, markdown, parentID, id, withMath)
+ id, err := model.CreateWithMarkdown(tags, notebook, hPath, markdown, parentID, id, withMath, clippingHref)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()
diff --git a/kernel/model/file.go b/kernel/model/file.go
index e3b481ba67..003808a2c0 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1154,7 +1154,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree
return
}
-func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bool) (retID string, err error) {
+func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bool, clippingHref string) (retID string, err error) {
createDocLock.Lock()
defer createDocLock.Unlock()
@@ -1170,6 +1170,16 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bo
luteEngine.SetInlineMath(true)
}
luteEngine.SetHTMLTag2TextMark(true)
+ if strings.HasPrefix(clippingHref, "https://ld246.com/article/") || strings.HasPrefix(clippingHref, "https://liuyun.io/article/") {
+ // 改进链滴剪藏 https://github.com/siyuan-note/siyuan/issues/13117
+ luteEngine.SetInlineAsterisk(true)
+ luteEngine.SetInlineUnderscore(true)
+ luteEngine.SetSup(true)
+ luteEngine.SetSub(true)
+ luteEngine.SetTag(true)
+ luteEngine.SetInlineMath(true)
+ luteEngine.SetGFMStrikethrough(true)
+ }
dom := luteEngine.Md2BlockDOM(md, false)
retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)