diff --git a/modules/markup/sanitizer_default.go b/modules/markup/sanitizer_default.go index 9c7259dc8cc..f7613b94dc4 100644 --- a/modules/markup/sanitizer_default.go +++ b/modules/markup/sanitizer_default.go @@ -70,6 +70,7 @@ func (st *Sanitizer) createDefaultPolicy() *bluemonday.Policy { "mi", "mn", "mo", "mtext", "mspace", "ms", // layout elements "mrow", "mfrac", "msqrt", "mroot", "mstyle", "merror", "mpadded", "mphantom", + "maction", // although MDN says "maction" is deprecated, we still need to allow it, otherwise, if it is removed, the layout will be wrong // scripting elements "msub", "msup", "msubsup", "munder", "mover", "munderover", "mmultiscripts", "mprescripts", "none", // tabular elements @@ -77,10 +78,11 @@ func (st *Sanitizer) createDefaultPolicy() *bluemonday.Policy { // semantic annotations "semantics", "annotation", "annotation-xml", } + policy.AllowNoAttrs().OnElements(mathMLElements...) // most MathML elements carry no attributes policy.AllowAttrs("display", "alttext").OnElements("math") policy.AllowAttrs( - // global presentation attributes - "dir", "displaystyle", "mathbackground", "mathcolor", "mathsize", "mathvariant", "scriptlevel", + // global attributes + "dir", "displaystyle", "mathbackground", "mathcolor", "mathsize", "mathvariant", "scriptlevel", "intent", "arg", // operator attributes "accent", "accentunder", "fence", "form", "largeop", "lspace", "maxsize", "minsize", "movablelimits", "rspace", "separator", "stretchy", "symmetric", // space and padding attributes @@ -90,7 +92,9 @@ func (st *Sanitizer) createDefaultPolicy() *bluemonday.Policy { // table attributes "columnalign", "columnlines", "columnspacing", "frame", "framespacing", "rowalign", "rowlines", "rowspacing", // cell attributes - "columnspan", + "columnspan", "rowspan", + // maction attributes + "actiontype", "selection", // annotation attribute "encoding", ).OnElements(mathMLElements...) diff --git a/modules/markup/sanitizer_default_test.go b/modules/markup/sanitizer_default_test.go index e344a96722f..56d67bced77 100644 --- a/modules/markup/sanitizer_default_test.go +++ b/modules/markup/sanitizer_default_test.go @@ -62,7 +62,10 @@ func TestSanitizer(t *testing.T) { `c`, `c`, // MathML - ``, ``, + ``, ``, + `x+12`, `x+12`, + `1`, `1`, + `x2`, `x2`, // Disallow dangerous url schemes `bad`, `bad`,