@@ -94,10 +94,10 @@ func createDefaultPolicy() *bluemonday.Policy {
9494 }
9595
9696 // Allow classes for anchors
97- policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`ref-issue( ref-external-issue)?` )).OnElements ("a" )
97+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^ ref-issue( ref-external-issue)?$ ` )).OnElements ("a" )
9898
9999 // Allow classes for task lists
100- policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`task-list-item` )).OnElements ("li" )
100+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^ task-list-item$ ` )).OnElements ("li" )
101101
102102 // Allow classes for org mode list item status.
103103 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^(unchecked|checked|indeterminate)$` )).OnElements ("li" )
@@ -106,7 +106,7 @@ func createDefaultPolicy() *bluemonday.Policy {
106106 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^icon(\s+[\p{L}\p{N}_-]+)+$` )).OnElements ("i" )
107107
108108 // Allow classes for emojis
109- policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`emoji` )).OnElements ("img" )
109+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^ emoji$ ` )).OnElements ("img" )
110110
111111 // Allow icons, emojis, chroma syntax and keyword markup on span
112112 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^((icon(\s+[\p{L}\p{N}_-]+)+)|(emoji)|(language-math display)|(language-math inline))$|^([a-z][a-z0-9]{0,2})$|^` + keywordClass + `$` )).OnElements ("span" )
@@ -122,13 +122,13 @@ func createDefaultPolicy() *bluemonday.Policy {
122122 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^header$" )).OnElements ("div" )
123123 policy .AllowAttrs ("data-line-number" ).Matching (regexp .MustCompile ("^[0-9]+$" )).OnElements ("span" )
124124 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^text small grey$" )).OnElements ("span" )
125- policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^file-preview* " )).OnElements ("table" )
125+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^file-preview$ " )).OnElements ("table" )
126126 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^lines-escape$" )).OnElements ("td" )
127127 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^toggle-escape-button btn interact-bg$" )).OnElements ("button" )
128128 policy .AllowAttrs ("title" ).OnElements ("button" )
129129 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^ambiguous-code-point$" )).OnElements ("span" )
130130 policy .AllowAttrs ("data-tooltip-content" ).OnElements ("span" )
131- policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("muted|(text black)" )).OnElements ("a" )
131+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^ muted|(text black)$ " )).OnElements ("a" )
132132 policy .AllowAttrs ("class" ).Matching (regexp .MustCompile ("^ui warning message tw-text-left$" )).OnElements ("div" )
133133
134134 // Allow generally safe attributes
0 commit comments