🎨 Export preview mode supports focus use https://github.com/siyuan-note/siyuan/issues/15340

This commit is contained in:
Daniel 2025-07-28 22:06:09 +08:00
parent 81644059ac
commit 49d233d92a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 12 additions and 6 deletions

View file

@ -431,7 +431,12 @@ func exportMdContent(c *gin.Context) {
fillCSSVar = arg["fillCSSVar"].(bool)
}
hPath, content := model.ExportMarkdownContent(id, refMode, embedMode, yfm, fillCSSVar)
adjustHeadingLevel := false
if nil != arg["adjustHeadingLevel"] {
adjustHeadingLevel = arg["adjustHeadingLevel"].(bool)
}
hPath, content := model.ExportMarkdownContent(id, refMode, embedMode, yfm, fillCSSVar, adjustHeadingLevel)
ret.Data = map[string]interface{}{
"hPath": hPath,
"content": content,

View file

@ -1458,12 +1458,13 @@ func processPDFLinkEmbedAssets(pdfCtx *model.Context, assetDests []string, remov
}
func ExportStdMarkdown(id string, assetsDestSpace2Underscore, adjustHeadingLevel bool) string {
tree, err := LoadTreeByBlockID(id)
if err != nil {
logging.LogErrorf("load tree by block id [%s] failed: %s", id, err)
bt := treenode.GetBlockTree(id)
if nil == bt {
logging.LogErrorf("block tree [%s] not found", id)
return ""
}
tree := prepareExportTree(bt)
cloudAssetsBase := ""
if IsSubscriber() {
cloudAssetsBase = util.GetCloudAssetsServer() + Conf.GetUser().UserId + "/"
@ -1981,7 +1982,7 @@ func walkRelationAvs(avID string, exportAvIDs *hashset.Set) {
}
}
func ExportMarkdownContent(id string, refMode, embedMode int, addYfm, fillCSSVar bool) (hPath, exportedMd string) {
func ExportMarkdownContent(id string, refMode, embedMode int, addYfm, fillCSSVar, adjustHeadingLv bool) (hPath, exportedMd string) {
bt := treenode.GetBlockTree(id)
if nil == bt {
return
@ -1989,7 +1990,7 @@ func ExportMarkdownContent(id string, refMode, embedMode int, addYfm, fillCSSVar
tree := prepareExportTree(bt)
hPath = tree.HPath
exportedMd = exportMarkdownContent0(id, tree, "", false, false,
exportedMd = exportMarkdownContent0(id, tree, "", false, adjustHeadingLv,
".md", refMode, embedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,