Background:
Regex lists exist in MediaWiki installation, including:
- MediaWiki:Titleblacklist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Titleblacklist
- MediaWiki:Titlewhitelist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Titlewhitelist
- MediaWiki:filename-prefix-blacklist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Filename-prefix-blacklist
- MediaWiki:Spam-blacklist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Spam-blacklist
- MediaWiki:Captcha-addurl-whitelist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Captcha-addurl-whitelist
- MediaWiki:Spam-whitelist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Spam-whitelist
- MediaWiki:Email-blacklist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Email-blacklist
- MediaWiki:Email-whitelist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Email-whitelist
- MediaWiki:pageimages-blacklist, e.g., https://en.wikipedia.org/wiki/MediaWiki:Pageimages-blacklist
Plus
https://meta.wikimedia.org/wiki/Title_blacklist
And possibly others that I've missed.
Observations:
There is currently no syntax highlighting on the Regex pages on Wikipedia. Presumably, nobody has thought to do it yet.
Syntax highlighting is possible however using <syntaxhighlight lang=python> or <syntaxhighlight lang=perl>, or <syntaxhighlight lang=bash>, etc. Note that, unfortunately, there is no <syntaxhighlight lang=regex>. The colour schemes vary a little depending on the lingo, but you end up with something like:
But where the code block begins...
# <syntaxhighlight lang=python>
The formatting ends up a little bit weird, because the parser initially treats it as WikiText:
or
It might be possible to start with <syntaxhighlight> tag not in a comment, but that would be treated as Regex, and might have unintended consequences, although page titles can't include <> so maybe it won't have any impact.
OK, so there is a quick fix, but let's dig a little deeper...
Which content model is best?:
Two possible content models are possible for this (both work the same, functionally):
- Plain text, which permits *no* syntax highlighting. After T202424 at least this looks like plain text.
- Wikitext, which allows syntax highlighting, but this clearly isn't really wikitext. It doesn't function as wikitext, and doing so produces some formatting issues.
And btw, it clearly isn't CSS or Javascript, but those two existing content models serve as examples of how to use content models on different types of pages, including appropriate syntax highlighting, and line numbers.
New content model is needed:
I think what's needed here, therefore, is an additional content model called Regex (or similar name). This would wrap the whole page in a <syntaxhighlight lang=python> (or whatever tag is preferred), and add line numbers, but otherwise function as Wikitext, and allow [[double-square bracket]] links and urls, e.g.
Thank you for your consideration. Sorry, this one is a bit long-winded.
Notes:
Add further notes here.




