🎨 新增获取块 kramdown 源代码的 API https://github.com/siyuan-note/siyuan/issues/5289

This commit is contained in:
Liang Ding 2022-06-27 23:03:31 +08:00
parent e1b45b40e5
commit 6723b3a20d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 121 additions and 30 deletions

View file

@ -100,6 +100,23 @@ func GetBlockDOM(id string) (ret string) {
return
}
func GetBlockKramdown(id string) (ret string) {
if "" == id {
return
}
tree, err := loadTreeByBlockID(id)
if nil != err {
return
}
addBlockIALNodes(tree)
node := treenode.GetNodeInTree(tree, id)
luteEngine := NewLute()
ret, _ = lute.FormatNodeSync(node, luteEngine.ParseOptions, luteEngine.RenderOptions)
return
}
func GetBlock(id string) (ret *Block, err error) {
ret, err = getBlock(id)
return