🎨 Preview mode supports jumping through the outline panel https://github.com/siyuan-note/siyuan/issues/3059

This commit is contained in:
Daniel 2023-06-17 15:49:16 +08:00
parent 78ff4a0963
commit f4982d2cd6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
7 changed files with 28 additions and 14 deletions

View file

@ -318,7 +318,7 @@ func exportData(exportFolder string) (zipPath string, err error) {
return
}
func Preview(id string) string {
func Preview(id string) (retStdHTML string, retOutline []*Path) {
tree, _ := loadTreeByBlockID(id)
tree = exportTree(tree, false, false, false,
Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
@ -329,7 +329,13 @@ func Preview(id string) string {
luteEngine.SetFootnotes(true)
md := treenode.FormatNode(tree.Root, luteEngine)
tree = parse.Parse("", []byte(md), luteEngine.ParseOptions)
return luteEngine.ProtylePreview(tree, luteEngine.RenderOptions)
retStdHTML = luteEngine.ProtylePreview(tree, luteEngine.RenderOptions)
if footnotesDefBlock := tree.Root.ChildByType(ast.NodeFootnotesDefBlock); nil != footnotesDefBlock {
footnotesDefBlock.Unlink()
}
retOutline = outline(tree)
return
}
func ExportDocx(id, savePath string, removeAssets, merge bool) (err error) {