Want to highlight 'Mediawiki Syntax' on a Mediawiki page

332 Views Asked by At

I've been asking Goodle and Stackoverflow variation of this query:

  • Syntax highlighting of mediawiki syntax

almost without exception I'm getting hits referring me to the Mediawiki Extension:SyntaxHighlight page. Unfortunately that is the question in this case, not the answer.

I did find a hit on MoinMoin ironically that wiki has MediaWiki syntax highlighting.

What I'd like to be able to do is to use syntaxhighlight around some mediawiki page mark-up to demonstrate how different pages or sections can be set-up. For now I'm using the <syntaxhighlight lang="text" ... >.

I'd like either a suitable "wiki"-highlight option or an workable alternative that will highlight some wiki markup. Ideally it would be fantastic to say:

  • <syntaxhighlight lang="mediawiki" > ... </syntaxhighlight>

I am surprised that this hasn't been asked before though.


edit 2016-05-09:

As a work around I have settled on the following for the time being. It isn't as pretty as having the final tag inside the syntaxhighlight but it gets the job done:

  ==  xml  ==

  <syntaxhighlight lang="text"  highlight="1,11">
  :<syntaxhighlight highlight="6" lang="xml">
  <tomcat-users ...>

    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>

    <user username="admin" password="****" roles="manager-gui,manager-script"/>
  </syntaxhighlight>
  <code><nowiki></syntaxhighlight></nowiki></code>

Which shows the closing </syntaxhighlight> tag outside the main box.

1

There are 1 best solutions below

1
2ark0 On

In the core, Extension:SyntaxHighlight uses Pygments, and it is extensible to make your own "syntax highlighting" or find a big set of other languages, take a look maybe you can find something useful, but I'm not sure that it will be something out of the box.