mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
🎨 新增获取块 kramdown 源代码的 API https://github.com/siyuan-note/siyuan/issues/5289
This commit is contained in:
parent
e1b45b40e5
commit
6723b3a20d
6 changed files with 121 additions and 30 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue