Last modified: 2014-05-04 19:47:31 UTC
Although bug 18820 claims that now it's possible to hilight even the code containing <source>, it's not possible in every case. Template:Code {{#tag:syntaxhighlight|{{{code}}}|lang={{{lang}}}}} Article: Lorem ipsum {{Code|lang=xml|code= <image> <source isrelative="false">/absolute/path/to/image.png</source> </image> }} The example above triggers error.
Definitely not "lowest" priority as it breaks many pages already.
By using #tag the purpose is to allow wikitext expansion. That means {{{parameters}}}, {{#parserfunctions}}, {{templates}}, but also <tags>. If you don't want that, use <nowiki>: {{#tag:syntaxhighlight|<nowiki> <image> <source isrelative="false">/absolute/path/to/image.png</source> </image> </nowiki> |lang=xml }} .. which works as expected. Example: https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=541325 Invalid?
I think the solution of bug 18820 would be to use: <syntaxhighlight lang=xml> <image> <source isrelative="false">/absolute/path/to/image.png</source> </image> </syntaxhighlight>
(In reply to comment #3) > I think the solution of bug 18820 would be to use: > <syntaxhighlight lang=xml> > <image> > <source isrelative="false">/absolute/path/to/image.png</source> > </image> > </syntaxhighlight> Nested tags don't work indeed (not unless the extension specifically does it, which in this case it doesn't and that's good). But the bug here is that it needs to work through a template. And the only way to pass a template value to a tag is to use {{#tag:}} because <tag> will take {{{foo}}} literally.
(In reply to comment #2) <nowiki> causes no hiliting, so you can't wrap the content in it. If you'll find more effective way than {{Code|lang=xml|code= <image> <<nowiki/>source isrelative="false">/absolute/path/to/image.png</source> </image> }} how to put <source> in template parameter, I would be more than happy, thank you.
I'm afraid no better way is possible, and no better way will ever be possible. It's just a limitation of wikitext syntax. :(