mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Fill style variables with actual values when exporting style elements https://github.com/siyuan-note/siyuan/issues/15026
https://github.com/siyuan-note/siyuan/issues/14032
This commit is contained in:
parent
249dbd2cc1
commit
11fdd64973
2 changed files with 16 additions and 7 deletions
|
@ -426,7 +426,12 @@ func exportMdContent(c *gin.Context) {
|
|||
yfm = arg["yfm"].(bool)
|
||||
}
|
||||
|
||||
hPath, content := model.ExportMarkdownContent(id, refMode, embedMode, yfm)
|
||||
fillCSSVar := false
|
||||
if nil != arg["fillCSSVar"] {
|
||||
fillCSSVar = arg["fillCSSVar"].(bool)
|
||||
}
|
||||
|
||||
hPath, content := model.ExportMarkdownContent(id, refMode, embedMode, yfm, fillCSSVar)
|
||||
ret.Data = map[string]interface{}{
|
||||
"hPath": hPath,
|
||||
"content": content,
|
||||
|
|
|
@ -272,7 +272,7 @@ func Export2Liandi(id string) (err error) {
|
|||
".md", 3, 1, 1,
|
||||
"#", "#",
|
||||
"", "",
|
||||
false, false, nil, true, &map[string]*parse.Tree{})
|
||||
false, false, nil, true, false, &map[string]*parse.Tree{})
|
||||
result := gulu.Ret.NewResult()
|
||||
request := httpclient.NewCloudRequest30s()
|
||||
request = request.
|
||||
|
@ -1491,7 +1491,7 @@ func ExportStdMarkdown(id string, assetsDestSpace2Underscore bool) string {
|
|||
".md", Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
|
||||
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
|
||||
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
|
||||
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, true, &map[string]*parse.Tree{})
|
||||
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, true, false, &map[string]*parse.Tree{})
|
||||
}
|
||||
|
||||
func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath string) {
|
||||
|
@ -1973,7 +1973,7 @@ func walkRelationAvs(avID string, exportAvIDs *hashset.Set) {
|
|||
}
|
||||
}
|
||||
|
||||
func ExportMarkdownContent(id string, refMode, embedMode int, addYfm bool) (hPath, exportedMd string) {
|
||||
func ExportMarkdownContent(id string, refMode, embedMode int, addYfm, fillCSSVar bool) (hPath, exportedMd string) {
|
||||
bt := treenode.GetBlockTree(id)
|
||||
if nil == bt {
|
||||
return
|
||||
|
@ -1985,7 +1985,7 @@ func ExportMarkdownContent(id string, refMode, embedMode int, addYfm bool) (hPat
|
|||
".md", refMode, embedMode, Conf.Export.FileAnnotationRefMode,
|
||||
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
|
||||
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
|
||||
Conf.Export.AddTitle, Conf.Export.InlineMemo, nil, true, &map[string]*parse.Tree{})
|
||||
Conf.Export.AddTitle, Conf.Export.InlineMemo, nil, true, fillCSSVar, &map[string]*parse.Tree{})
|
||||
docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
|
||||
if addYfm {
|
||||
exportedMd = yfm(docIAL) + exportedMd
|
||||
|
@ -2004,7 +2004,7 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
|
|||
ext, exportRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
|
||||
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
|
||||
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
|
||||
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, singleFile, treeCache)
|
||||
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, singleFile, true, treeCache)
|
||||
docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
|
||||
if Conf.Export.MarkdownYFM {
|
||||
// 导出 Markdown 时在文档头添加 YFM 开关 https://github.com/siyuan-note/siyuan/issues/7727
|
||||
|
@ -2016,7 +2016,7 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
|
|||
func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDestSpace2Underscore bool,
|
||||
ext string, blockRefMode, blockEmbedMode, fileAnnotationRefMode int,
|
||||
tagOpenMarker, tagCloseMarker string, blockRefTextLeft, blockRefTextRight string,
|
||||
addTitle, inlineMemo bool, defBlockIDs []string, singleFile bool, treeCache *map[string]*parse.Tree) (ret string) {
|
||||
addTitle, inlineMemo bool, defBlockIDs []string, singleFile, fillCSSVar bool, treeCache *map[string]*parse.Tree) (ret string) {
|
||||
tree = exportTree(tree, false, false, false,
|
||||
blockRefMode, blockEmbedMode, fileAnnotationRefMode,
|
||||
tagOpenMarker, tagCloseMarker,
|
||||
|
@ -2123,6 +2123,10 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
|
|||
unlink.Unlink()
|
||||
}
|
||||
|
||||
if fillCSSVar {
|
||||
fillThemeStyleVar(tree)
|
||||
}
|
||||
|
||||
luteEngine.SetUnorderedListMarker("-")
|
||||
renderer := render.NewProtyleExportMdRenderer(tree, luteEngine.RenderOptions)
|
||||
ret = gulu.Str.FromBytes(renderer.Render())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue