Dror S.
Dror S.

Reputation: 1110

How to blacklist additional HTML tags in MediaWiki?

I really dislike the non-semantic usage of <big> on our wiki, and would like to prevent it. Flat-out commands didn't work so far, so I'm switching to doing it by code...

AFAIK, there's no configuration switch to control the blacklist/whitelist of HTML tags. Looking at the source code, it seems like the data is coming from Sanitizer::getRecognizedTagData(), while the work itself is done in Sanitizer::removeHTMLtags(). However, I do not see a way to add to the list myself, except using one of the hooks before or after (InternalParseBeforeSanitize, InternalParseBeforeLinks) and either:

  1. Call Sanitizer::removeHTMLtags() again myself, with the additional tag to blacklist as a parameter
  2. Do a search myself on the text to remove all the <big> tags.

The first one is a duplication of work, the second one is a duplication of code. Is there a better way? What would you recommend?

Upvotes: 1

Views: 75

Answers (1)

MaxSem
MaxSem

Reputation: 3547

No coding is needed: just install AbuseFilter and create a rule that warns or disallows on save of pages containing these tags.

Upvotes: 3

Related Questions