From 1d83eada71c5764a9009723f86cfc0d0aa7b2439 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 30 Jan 2023 11:17:12 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=A4=A7=E7=BA=B2=E5=AD=97=E5=8F=B7?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=AF=A5=E8=B7=9F=E9=9A=8F=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=20Fix=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/7202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/render.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/model/render.go b/kernel/model/render.go index 54f805393..73047513c 100644 --- a/kernel/model/render.go +++ b/kernel/model/render.go @@ -18,6 +18,7 @@ package model import ( "bytes" + "regexp" "strings" "github.com/88250/gulu" @@ -46,6 +47,14 @@ func renderOutline(node *ast.Node, luteEngine *lute.Lute) (ret string) { if !entering { return ast.WalkContinue } + + if style := n.IALAttr("style"); "" != style { + if strings.Contains(style, "font-size") { // 大纲字号不应该跟随字体设置 https://github.com/siyuan-note/siyuan/issues/7202 + style = regexp.MustCompile("font-size:.*?;").ReplaceAllString(style, "font-size: inherit;") + n.SetIALAttr("style", style) + } + } + switch n.Type { case ast.NodeText, ast.NodeLinkText, ast.NodeCodeBlockCode, ast.NodeMathBlockContent: tokens := html.EscapeHTML(n.Tokens)