mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🎨 Improve clipping for ld246.com https://github.com/siyuan-note/siyuan/issues/13117
This commit is contained in:
parent
542f287d88
commit
255afcc9ad
2 changed files with 17 additions and 2 deletions
|
|
@ -742,8 +742,13 @@ func createDocWithMd(c *gin.Context) {
|
||||||
if nil != withMathArg {
|
if nil != withMathArg {
|
||||||
withMath = withMathArg.(bool)
|
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 {
|
if err != nil {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
|
|
|
||||||
|
|
@ -1154,7 +1154,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree
|
||||||
return
|
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()
|
createDocLock.Lock()
|
||||||
defer createDocLock.Unlock()
|
defer createDocLock.Unlock()
|
||||||
|
|
||||||
|
|
@ -1170,6 +1170,16 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bo
|
||||||
luteEngine.SetInlineMath(true)
|
luteEngine.SetInlineMath(true)
|
||||||
}
|
}
|
||||||
luteEngine.SetHTMLTag2TextMark(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)
|
dom := luteEngine.Md2BlockDOM(md, false)
|
||||||
retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)
|
retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue