Skip to content

Commit a742cf7

Browse files
committed
fix sanitizer regexp
1 parent e6a4733 commit a742cf7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

modules/markup/sanitizer.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ func InitializeSanitizer() {
5353
func createDefaultPolicy() *bluemonday.Policy {
5454
policy := bluemonday.UGCPolicy()
5555

56-
// For JS code copy
57-
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-block$`)).OnElements("pre")
56+
// For JS code copy and Mermaid loading state
57+
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-block( is-loading)?$`)).OnElements("pre")
5858

5959
// For Chroma markdown plugin
60-
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^is-loading$`)).OnElements("pre")
6160
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^(chroma )?language-[\w-]+$`)).OnElements("code")
6261

6362
// Checkboxes

0 commit comments

Comments
 (0)