Talk:HTML restriction
Latest comment: 6 years ago by Loizbec in topic Table tags
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
How to implement?
editCan someone elaborate on how to implement the code to allow HTML on wiki pages? This page provies no help and the external link to the HTML Sanitizer comes with no how-to or documetation.
--22 September 2006
End of content from meta.wikimedia.org.
Note that the above conversation may have been edited or added to since the transfer. If in doubt, check the edit history.
Note that the above conversation may have been edited or added to since the transfer. If in doubt, check the edit history.
Table tags
editI think that thead and tbody should be added to the whitelist…
In my instance of mediawiki I have modified Sanitizer.php, the following way, but it is not a good idea as when I update my instance, my templates using those tags will magically unwork. If anyone is in my situation, here are the modified code lines :
$htmlpairsStatic = [ # Tags that must be closed 'b', 'bdi', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's', 'strike', 'strong', 'tt', 'var', 'div', 'center', 'blockquote', 'ol', 'ul', 'dl', 'table', 'thead', 'tbody', 'caption', 'pre', 'ruby', 'rb', 'rp', 'rt', 'rtc', 'p', 'span', 'abbr', 'dfn', 'kbd', 'samp', 'data', 'time', 'mark' ]; $htmlnest = [ # Tags that can be nested--?? 'table', 'thead', 'tbody', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'font', 'big', 'small', 'sub', 'sup', 'span', 'var', 'kbd', 'samp', 'em', 'strong', 'q', 'ruby', 'bdo' ]; $tabletags = [ # Can only appear inside table, we will close them 'td', 'th', 'tr', 'thead', 'tbody' ];