@@ -14,7 +14,7 @@ const katex = window.katex
1414const sanitizeOpts = {
1515 allowedTags : [ 'h1' , 'h2' , 'h3' , 'h4' , 'h5' , 'h6' , 'blockquote' , 'p' , 'a' , 'ul' , 'ol' ,
1616 'nl' , 'li' , 'b' , 'i' , 'strong' , 'em' , 'strike' , 'code' , 'hr' , 'br' , 'div' ,
17- 'table' , 'thead' , 'caption' , 'tbody' , 'tr' , 'th' , 'td' , 'pre' , 'img' , 'span' , 'cite' , 'del' , 'u' , 'sub' , 'sup' ] ,
17+ 'table' , 'thead' , 'caption' , 'tbody' , 'tr' , 'th' , 'td' , 'pre' , 'img' , 'span' , 'cite' , 'del' , 'u' , 'sub' , 'sup' , 's' , 'input' , 'label' ] ,
1818 allowedClasses : {
1919 'a' : [ 'lineAnchor' ] ,
2020 'div' : [ 'math' ] ,
@@ -24,14 +24,20 @@ const sanitizeOpts = {
2424 allowedAttributes : {
2525 a : [ 'href' , 'data-key' ] ,
2626 img : [ 'src' ] ,
27+ label : [ 'for' ] ,
28+ input : [ 'checked' , 'type' ] ,
2729 '*' : [ 'id' , 'name' ]
2830 } ,
2931 transformTags : {
3032 '*' : function ( tagName , attribs ) {
3133 let href = attribs . href
34+ if ( tagName === 'input' && attribs . type !== 'checkbox' ) {
35+ return false
36+ }
3237 if ( _ . isString ( href ) && href . match ( / ^ # .+ $ / ) ) attribs . href = href . replace ( / ^ # / , '#md-anchor-' )
3338 if ( attribs . id ) attribs . id = 'md-anchor-' + attribs . id
3439 if ( attribs . name ) attribs . name = 'md-anchor-' + attribs . name
40+ if ( attribs . for ) attribs . for = 'md-anchor-' + attribs . for
3541 return {
3642 tagName : tagName ,
3743 attribs : attribs
0 commit comments