From cc8444deecbc63c263de57649d30ececc29c6e8c Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 9 Feb 2024 22:08:35 +0000 Subject: [PATCH 01/13] Add alert blocks in markdown Signed-off-by: Yarden Shoham --- modules/markup/markdown/ast.go | 7 +-- modules/markup/markdown/goldmark.go | 82 +++++++++++++++++++++++------ modules/markup/sanitizer.go | 3 +- web_src/css/base.css | 44 ++++++++++++++-- 4 files changed, 109 insertions(+), 27 deletions(-) diff --git a/modules/markup/markdown/ast.go b/modules/markup/markdown/ast.go index 3e6e291ab25a..77ce5cb359b9 100644 --- a/modules/markup/markdown/ast.go +++ b/modules/markup/markdown/ast.go @@ -182,12 +182,7 @@ func IsColorPreview(node ast.Node) bool { return ok } -const ( - AttentionNote string = "Note" - AttentionWarning string = "Warning" -) - -// Attention is an inline for a color preview +// Attention is an inline for an attention type Attention struct { ast.BaseInline AttentionType string diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index 178e3d2fddf8..a2483ad43594 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -53,7 +53,6 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa } } - attentionMarkedBlockquotes := make(container.Set[*ast.Blockquote]) _ = ast.Walk(node, func(n ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil @@ -197,18 +196,62 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa if css.ColorHandler(strings.ToLower(string(colorContent))) { v.AppendChild(v, NewColorPreview(colorContent)) } - case *ast.Emphasis: - // check if inside blockquote for attention, expected hierarchy is - // Emphasis < Paragraph < Blockquote - blockquote, isInBlockquote := n.Parent().Parent().(*ast.Blockquote) - if isInBlockquote && !attentionMarkedBlockquotes.Contains(blockquote) { - fullText := string(n.Text(reader.Source())) - if fullText == AttentionNote || fullText == AttentionWarning { - v.SetAttributeString("class", []byte("attention-"+strings.ToLower(fullText))) - v.Parent().InsertBefore(v.Parent(), v, NewAttention(fullText)) - attentionMarkedBlockquotes.Add(blockquote) - } + case *ast.Blockquote: + // We only want attention blockquotes when the AST looks like: + // Text: "[" + // Text: "!TYPE" + // Text(SoftLineBreak): "]" + + // grab these nodes + firstParagraph := v.FirstChild() + if firstParagraph.ChildCount() < 3 { + return ast.WalkContinue, nil + } + firstTextNode, ok := firstParagraph.FirstChild().(*ast.Text) + if !ok { + return ast.WalkContinue, nil + } + secondTextNode, ok := firstTextNode.NextSibling().(*ast.Text) + if !ok { + return ast.WalkContinue, nil + } + thirdTextNode, ok := secondTextNode.NextSibling().(*ast.Text) + if !ok { + return ast.WalkContinue, nil } + + // make sure we adhere to the attention blockquote structure + if string(firstTextNode.Segment.Value(reader.Source())) != "[" || + !attentionTypeRE.MatchString(string(secondTextNode.Segment.Value(reader.Source()))) || + string(thirdTextNode.Segment.Value(reader.Source())) != "]" { + return ast.WalkContinue, nil + } + + // grab attention type from markdown source + attentionType := strings.ToLower(strings.TrimPrefix(string(secondTextNode.Segment.Value(reader.Source())), "!")) + + // color the blockquote + v.SetAttributeString("class", []byte("gt-py-3 attention attention-"+attentionType)) + + // create an emphasis to make it bold + emphasis := ast.NewEmphasis(2) + emphasis.SetAttributeString("class", []byte("gt-font-bold attention-"+attentionType)) + firstParagraph.InsertBefore(firstParagraph, firstTextNode, emphasis) + + // capitalize first letter + attentionText := ast.NewString([]byte(strings.ToUpper(string(attentionType[0])) + attentionType[1:])) + + // replace the ![TYPE] with icon+Type + emphasis.AppendChild(emphasis, attentionText) + for i := 0; i < 2; i++ { + lineBreak := ast.NewText() + lineBreak.SetSoftLineBreak(true) + firstParagraph.InsertAfter(firstParagraph, emphasis, lineBreak) + } + firstParagraph.InsertBefore(firstParagraph, emphasis, NewAttention(attentionType)) + firstParagraph.RemoveChild(firstParagraph, firstTextNode) + firstParagraph.RemoveChild(firstParagraph, secondTextNode) + firstParagraph.RemoveChild(firstParagraph, thirdTextNode) } return ast.WalkContinue, nil }) @@ -346,10 +389,16 @@ func (r *HTMLRenderer) renderAttention(w util.BufWriter, source []byte, node ast var octiconType string switch n.AttentionType { - case AttentionNote: + case "note": octiconType = "info" - case AttentionWarning: + case "tip": + octiconType = "light-bulb" + case "important": + octiconType = "report" + case "warning": octiconType = "alert" + case "caution": + octiconType = "stop" } _, _ = w.WriteString(string(svg.RenderHTML("octicon-" + octiconType))) } else { @@ -417,7 +466,10 @@ func (r *HTMLRenderer) renderSummary(w util.BufWriter, source []byte, node ast.N return ast.WalkContinue, nil } -var validNameRE = regexp.MustCompile("^[a-z ]+$") +var ( + validNameRE = regexp.MustCompile("^[a-z ]+$") + attentionTypeRE = regexp.MustCompile("^!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)$") +) func (r *HTMLRenderer) renderIcon(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 992e85b9898d..176ad383abfe 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -64,7 +64,8 @@ func createDefaultPolicy() *bluemonday.Policy { policy.AllowAttrs("class").Matching(regexp.MustCompile(`^color-preview$`)).OnElements("span") // For attention - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-\w+$`)).OnElements("strong") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-py-3 attention attention-\w+$`)).OnElements("blockquote") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-font-bold attention-\w+$`)).OnElements("strong") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-icon attention-\w+$`)).OnElements("span", "strong") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-\w+$`)).OnElements("svg") policy.AllowAttrs("viewBox", "width", "height", "aria-hidden").OnElements("svg") diff --git a/web_src/css/base.css b/web_src/css/base.css index 198e87c0e202..19f1e99f9cf3 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1268,20 +1268,54 @@ img.ui.avatar, border-radius: var(--border-radius); } +.attention { + color: unset !important; +} + .attention-icon { vertical-align: text-top; } -.attention-note { - font-weight: unset; - color: var(--color-info-text); +blockquote.attention-note { + border-left-color: var(--color-blue-dark-2); +} + +blockquote.attention-tip { + border-left-color: var(--color-success-border); } -.attention-warning { - font-weight: unset; +blockquote.attention-important { + border-left-color: var(--color-violet-dark-2); +} + +blockquote.attention-warning { + border-left-color: var(--color-warning-text); +} + +blockquote.attention-caution { + border-left-color: var(--color-red-dark-2); +} + +strong.attention-note, .attention-icon.attention-note { + color: var(--color-blue-dark-2); +} + +strong.attention-tip, .attention-icon.attention-tip { + color: var(--color-success-border); +} + +strong.attention-important, .attention-icon.attention-important { + color: var(--color-violet-dark-2); +} + +strong.attention-warning, .attention-icon.attention-warning { color: var(--color-warning-text); } +strong.attention-caution, .attention-icon.attention-caution { + color: var(--color-red-dark-2); +} + .center:not(.popup) { text-align: center; } From def2baecd90073bbf53ebb48aa1a55c969cd756a Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 08:17:23 +0000 Subject: [PATCH 02/13] Vertical align the icons Signed-off-by: Yarden Shoham --- modules/markup/markdown/goldmark.go | 2 +- modules/markup/sanitizer.go | 2 +- web_src/css/base.css | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index a2483ad43594..3fd7f7750589 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -382,7 +382,7 @@ func (r *HTMLRenderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Nod // renderAttention renders a quote marked with i.e. "> **Note**" or "> **Warning**" with a corresponding svg func (r *HTMLRenderer) renderAttention(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if entering { - _, _ = w.WriteString(``) diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 176ad383abfe..2cb95a7b4bd1 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -66,7 +66,7 @@ func createDefaultPolicy() *bluemonday.Policy { // For attention policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-py-3 attention attention-\w+$`)).OnElements("blockquote") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-font-bold attention-\w+$`)).OnElements("strong") - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-icon attention-\w+$`)).OnElements("span", "strong") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-vm attention-\w+$`)).OnElements("span", "strong") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-\w+$`)).OnElements("svg") policy.AllowAttrs("viewBox", "width", "height", "aria-hidden").OnElements("svg") policy.AllowAttrs("fill-rule", "d").OnElements("path") diff --git a/web_src/css/base.css b/web_src/css/base.css index 19f1e99f9cf3..4cd8144efeef 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1272,10 +1272,6 @@ img.ui.avatar, color: unset !important; } -.attention-icon { - vertical-align: text-top; -} - blockquote.attention-note { border-left-color: var(--color-blue-dark-2); } From 56d7f4fe3f3dd05ae95d37b01ef6f5299d884098 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 08:19:53 +0000 Subject: [PATCH 03/13] Fix ref Signed-off-by: Yarden Shoham --- web_src/css/base.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 4cd8144efeef..3e0764b199ff 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1292,23 +1292,23 @@ blockquote.attention-caution { border-left-color: var(--color-red-dark-2); } -strong.attention-note, .attention-icon.attention-note { +strong.attention-note, span.attention-note { color: var(--color-blue-dark-2); } -strong.attention-tip, .attention-icon.attention-tip { +strong.attention-tip, span.attention-tip { color: var(--color-success-border); } -strong.attention-important, .attention-icon.attention-important { +strong.attention-important, span.attention-important { color: var(--color-violet-dark-2); } -strong.attention-warning, .attention-icon.attention-warning { +strong.attention-warning, span.attention-warning { color: var(--color-warning-text); } -strong.attention-caution, .attention-icon.attention-caution { +strong.attention-caution, span.attention-caution { color: var(--color-red-dark-2); } From fd33c94aff6c2c40c8d85477b13550dd2dac60eb Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 08:56:34 +0000 Subject: [PATCH 04/13] Fix tip not being green --- web_src/css/base.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 3e0764b199ff..f562e85c4779 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1296,8 +1296,9 @@ strong.attention-note, span.attention-note { color: var(--color-blue-dark-2); } -strong.attention-tip, span.attention-tip { +strong.attention-tip, span.attention-tip, .attention-tip svg path { color: var(--color-success-border); + fill: var(--color-success-border); } strong.attention-important, span.attention-important { From 03882cf0864d3a09d74b205e11f93e3fb64a90f1 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 09:07:16 +0000 Subject: [PATCH 05/13] Fail fast Signed-off-by: Yarden Shoham --- modules/markup/markdown/goldmark.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index 3fd7f7750589..e649c6fdfc56 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -202,28 +202,21 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa // Text: "!TYPE" // Text(SoftLineBreak): "]" - // grab these nodes + // grab these nodes and make sure we adhere to the attention blockquote structure firstParagraph := v.FirstChild() if firstParagraph.ChildCount() < 3 { return ast.WalkContinue, nil } firstTextNode, ok := firstParagraph.FirstChild().(*ast.Text) - if !ok { + if !ok || string(firstTextNode.Segment.Value(reader.Source())) != "[" { return ast.WalkContinue, nil } secondTextNode, ok := firstTextNode.NextSibling().(*ast.Text) - if !ok { + if !ok || !attentionTypeRE.MatchString(string(secondTextNode.Segment.Value(reader.Source()))) { return ast.WalkContinue, nil } thirdTextNode, ok := secondTextNode.NextSibling().(*ast.Text) - if !ok { - return ast.WalkContinue, nil - } - - // make sure we adhere to the attention blockquote structure - if string(firstTextNode.Segment.Value(reader.Source())) != "[" || - !attentionTypeRE.MatchString(string(secondTextNode.Segment.Value(reader.Source()))) || - string(thirdTextNode.Segment.Value(reader.Source())) != "]" { + if !ok || string(thirdTextNode.Segment.Value(reader.Source())) != "]" { return ast.WalkContinue, nil } From 683226544e95ddbdaf58f386e07e42f5952e0b16 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 09:19:58 +0000 Subject: [PATCH 06/13] Fix colors Signed-off-by: Yarden Shoham --- web_src/css/base.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index f562e85c4779..3590502f8fb0 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1277,7 +1277,7 @@ blockquote.attention-note { } blockquote.attention-tip { - border-left-color: var(--color-success-border); + border-left-color: var(--color-success-text); } blockquote.attention-important { @@ -1297,8 +1297,8 @@ strong.attention-note, span.attention-note { } strong.attention-tip, span.attention-tip, .attention-tip svg path { - color: var(--color-success-border); - fill: var(--color-success-border); + color: var(--color-success-text); + fill: var(--color-success-text); } strong.attention-important, span.attention-important { From 4411b1eb067e18d5b425d06005e4a3a05026a315 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 14:16:06 +0000 Subject: [PATCH 07/13] Add margin Signed-off-by: Yarden Shoham --- modules/markup/markdown/goldmark.go | 4 ++-- modules/markup/sanitizer.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index e649c6fdfc56..36ce6397f4d8 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -228,7 +228,7 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa // create an emphasis to make it bold emphasis := ast.NewEmphasis(2) - emphasis.SetAttributeString("class", []byte("gt-font-bold attention-"+attentionType)) + emphasis.SetAttributeString("class", []byte("attention-"+attentionType)) firstParagraph.InsertBefore(firstParagraph, firstTextNode, emphasis) // capitalize first letter @@ -375,7 +375,7 @@ func (r *HTMLRenderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Nod // renderAttention renders a quote marked with i.e. "> **Note**" or "> **Warning**" with a corresponding svg func (r *HTMLRenderer) renderAttention(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if entering { - _, _ = w.WriteString(``) diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 2cb95a7b4bd1..39b4d8af1e3b 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -65,8 +65,8 @@ func createDefaultPolicy() *bluemonday.Policy { // For attention policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-py-3 attention attention-\w+$`)).OnElements("blockquote") - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-font-bold attention-\w+$`)).OnElements("strong") - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-vm attention-\w+$`)).OnElements("span", "strong") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-\w+$`)).OnElements("strong") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-mr-2 gt-vm attention-\w+$`)).OnElements("span", "strong") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-\w+$`)).OnElements("svg") policy.AllowAttrs("viewBox", "width", "height", "aria-hidden").OnElements("svg") policy.AllowAttrs("fill-rule", "d").OnElements("path") From a15cf406e6a9ec8ce7b764f748128d994f02f6fd Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 16:43:39 +0000 Subject: [PATCH 08/13] Lighter note and caution Signed-off-by: Yarden Shoham --- web_src/css/base.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 3590502f8fb0..ea7f8de483a3 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1273,7 +1273,7 @@ img.ui.avatar, } blockquote.attention-note { - border-left-color: var(--color-blue-dark-2); + border-left-color: var(--color-blue-dark-1); } blockquote.attention-tip { @@ -1289,11 +1289,11 @@ blockquote.attention-warning { } blockquote.attention-caution { - border-left-color: var(--color-red-dark-2); + border-left-color: var(--color-red-dark-1); } strong.attention-note, span.attention-note { - color: var(--color-blue-dark-2); + color: var(--color-blue-dark-1); } strong.attention-tip, span.attention-tip, .attention-tip svg path { @@ -1310,7 +1310,7 @@ strong.attention-warning, span.attention-warning { } strong.attention-caution, span.attention-caution { - color: var(--color-red-dark-2); + color: var(--color-red-dark-1); } .center:not(.popup) { From ac2055a367d3533d450d0967f4b33b8da448d2c2 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 10 Feb 2024 18:11:02 +0100 Subject: [PATCH 09/13] Lighten important --- web_src/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index ea7f8de483a3..e2347308731d 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1281,7 +1281,7 @@ blockquote.attention-tip { } blockquote.attention-important { - border-left-color: var(--color-violet-dark-2); + border-left-color: var(--color-violet-dark-1); } blockquote.attention-warning { From 2a945f1314805e542b94acadcc9215343b75838a Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 17:13:45 +0000 Subject: [PATCH 10/13] Also text color --- web_src/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index e2347308731d..29c51747a654 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1302,7 +1302,7 @@ strong.attention-tip, span.attention-tip, .attention-tip svg path { } strong.attention-important, span.attention-important { - color: var(--color-violet-dark-2); + color: var(--color-violet-dark-1); } strong.attention-warning, span.attention-warning { From 3d1a69022c259d99f9f5dde164a806cb52317628 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 10 Feb 2024 18:15:39 +0100 Subject: [PATCH 11/13] group css colors together --- web_src/css/base.css | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 29c51747a654..b85fc5cdb0a1 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1275,40 +1275,34 @@ img.ui.avatar, blockquote.attention-note { border-left-color: var(--color-blue-dark-1); } +strong.attention-note, span.attention-note { + color: var(--color-blue-dark-1); +} blockquote.attention-tip { border-left-color: var(--color-success-text); } +strong.attention-tip, span.attention-tip { + color: var(--color-success-text); +} blockquote.attention-important { border-left-color: var(--color-violet-dark-1); } - -blockquote.attention-warning { - border-left-color: var(--color-warning-text); -} - -blockquote.attention-caution { - border-left-color: var(--color-red-dark-1); -} - -strong.attention-note, span.attention-note { - color: var(--color-blue-dark-1); -} - -strong.attention-tip, span.attention-tip, .attention-tip svg path { - color: var(--color-success-text); - fill: var(--color-success-text); -} - strong.attention-important, span.attention-important { color: var(--color-violet-dark-1); } +blockquote.attention-warning { + border-left-color: var(--color-warning-text); +} strong.attention-warning, span.attention-warning { color: var(--color-warning-text); } +blockquote.attention-caution { + border-left-color: var(--color-red-dark-1); +} strong.attention-caution, span.attention-caution { color: var(--color-red-dark-1); } From 97668d72dd08480aa7f359ef3953eb4022a35a9d Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 10 Feb 2024 17:26:53 +0000 Subject: [PATCH 12/13] Fix sanitizer Signed-off-by: Yarden Shoham --- modules/markup/sanitizer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 39b4d8af1e3b..ffc33c3b8e5b 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -67,7 +67,7 @@ func createDefaultPolicy() *bluemonday.Policy { policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-py-3 attention attention-\w+$`)).OnElements("blockquote") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-\w+$`)).OnElements("strong") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^gt-mr-2 gt-vm attention-\w+$`)).OnElements("span", "strong") - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-\w+$`)).OnElements("svg") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-(\w|-)+$`)).OnElements("svg") policy.AllowAttrs("viewBox", "width", "height", "aria-hidden").OnElements("svg") policy.AllowAttrs("fill-rule", "d").OnElements("path") From f6e114bb113a5cff3ac3735bd2a6569dc0fd9924 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 10 Feb 2024 18:36:51 +0100 Subject: [PATCH 13/13] use explicit color --- web_src/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index b85fc5cdb0a1..ea32aac6f777 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1269,7 +1269,7 @@ img.ui.avatar, } .attention { - color: unset !important; + color: var(--color-text) !important; } blockquote.attention-note {