Jump to content

Talk:HTML restriction

Add topic
From mediawiki.org
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).

How to implement?

[edit]

Can 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

Table tags

[edit]

I 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'
];

--Loizbec (talk) 16:51, 5 January 2018 (UTC)Reply