🎨 Use real theme style value replace var in preview mode https://github.com/siyuan-note/siyuan/issues/11458

This commit is contained in:
Daniel 2024-11-17 12:05:35 +08:00
parent 317e84dd7b
commit 35d1c10633
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -22,6 +22,7 @@ import (
"path/filepath"
"strings"
"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/gorilla/css/scanner"
@ -54,6 +55,10 @@ func fillThemeStyleVar(tree *parse.Tree) {
buf.WriteString(style)
buf.WriteString(": ")
value := themeStyles[name]
if strings.Contains(value, "-b3-") {
name = gulu.Str.SubStringBetween(value, "(", ")")
value = themeStyles[name]
}
if "" == value {
// 回退为变量
buf.WriteString("var(")