Make a line of source code bold in MediaWiki
I'm using a default install of MediaWiki and am trying to emphasize a certain line of code to students in a lab text I am writing.
Specifically, I am trying to bold the template line in:
template <typename T>
class Node {
This doesn't work开发者_开发问答:
<code>
<b>template <typename T></b><br>
class Node {
</code>
Is there a way to do this in default MediaWiki?
The precise thing you've written seems to work on mediawiki.org, I just tried it in the sandbox:
http://www.mediawiki.org/w/index.php?title=Sandbox&oldid=429106
It's a very subtle bolding effect. But it's definitely different than when you don't have the <b>
tags. You might need to throw in some CSS for bolded things to make it more obvious:
http://www.mediawiki.org/wiki/Manual:CSS
A note on a question you didn't ask (but I answered initially anyway): if you're not inside a code block, the nonsensical markup language of MediaWiki uses '''three apostrophes'''
to bound bold text and ''two for italics''
:
http://www.mediawiki.org/wiki/Help:Formatting
I'd imagine if your installation is a default, all the things in that document will work. Wikipedia has some extensions installed so you can't necessarily get the things there that you see when you click "edit" on a page to work. That would be fun stuff like the chess boards, for instance:
http://www.mediawiki.org/wiki/Extension:EmbedChessboard
Another unsolicited note I'll throw in is that I like to use bold to distinguish declarations and references. So I write things like:
template <typename T>
class Node {
I also like my code to use proportional fonts and tabs. :)
If it was me, and I was trying to put that on a wiki that doesn't have the <source lang= ???>
tag set up, I would type it up in my favorite text editor (Notepad ++ 6.x), take a screen-shot, paste the screenshot into paint, crop it out the way I want it to look, save it to a XXsource.png picture file, upload it to the wiki, and include it on the page where I want it.
精彩评论