The source code for templates in Wikipedia, Wiktionary, and all MediaWiki is usually written in a congealed lump like this:

<includeonly>{{#if:{{{2|}}}|[[{{{1}}}#{{{2}}}]]|[[{{{1}}}]]}} - [http://www.onelook.com/?w={{urlencode:{{{1|{{PAGENAME}}}}}}}&ls=a OneLook] - {{googles|"{{{1}}}"}}</includeonly><noinclude>{{documentation}}</noinclude>

As you can see it's very hard to read, to match the various kinds of brackets and braces and pipes, etc. It's hard to get any idea what somebody else's template code does.

I'm looking for a code editor on Mac or Windows, even Linux that can both syntax highlight and beautify/indent this code. It would be great if it could also re-minify it back into the congealed lump afterwards so other wiki contributors don't complain (-;

I'd also be interested in a plugin or mode for any existing editor that can add these functions.

  • I can try to make, plugin for CudaText. I need only Python library for Mediawiki minify/ unminify. I cannot find it yet.
    – RProgram
    Commented Jun 10, 2016 at 10:23
  • I doubt there is such a library, but you never know. It could be as simple as removing all whitespace that's not part of a template name or a string. Commented Jun 11, 2016 at 3:07

1 Answer 1


SynWrite (Windows only); CudaText (cross-platform) share the same lexer MediaWiki. Install it using AddonsManager menu. This lexer hilites Mediawiki text as follows:


I don't think some app can minify/unminify Mediawiki. So no plugin exists here.

  • Aha there's a syntax highlighter in some parts of MediaWiki right now. I'm not sure if it's an addon I found or if it's included. It's fine for Wikipedia articles like in your pic. But for dense "magic" template code like in my example with nested double and triple braces it's not enough to figure out what's happening without indent/prettify/beautify. Commented Jun 11, 2016 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.