MediaWiki User Guide/Text Formatting
The following is an overview of text formatting available in Mediawiki:
Formatting | Markup | Note |
---|---|---|
Boldface | '''text'''
|
|
Italics | ''text''
|
|
Boldface and italics | '''''text'''''
|
|
Boldface combined with wikilink | '''[[text]]'''
|
The reverse order of ticks and brackets does not work: [['''text''']]
|
Other text formatting such as underline or blockquote needs to be done using HTML tags, including U for underline, TT for typewriter text, S for strikethrough, SUB for lower index and SUP for upper index.
HTML
editText formatting can also be done using HTML and CSS. Some of the most useful HTML elements are:
Task | Markup | Note |
---|---|---|
Preformatted text | <pre>
preformatted
</pre>
|
The effect in wiki differs from the one in HTML; in wiki, the text within the PRE element is treated as within NOWIKI element, leaving all the HTML and wiki markup uninterpreted. |
Blockquote | <blockquote>Longer passage.</blockquote>
| |
Comments | <!-- comment -->
|
Avoid nesting, such as <!-- <!-- comment --> -->
|
Generic inline element | <span style="TODO"></span>
|
Can be styled arbitrarily using cascading style sheets - CSS. |
Generic block element | <div style="TODO"></div>
|
Can be styled arbitrarily using cascading style sheets - CSS. |
Some HTML elements are not allowed, such as A and IMG.
Source code
editSource code of various programming and markup languages can be formatted using <syntaxhighlight> element, which leads to colored syntax of the code.
An example of wiki markup:
<syntaxhighlight lang="html4strict"> <html> <body> <p>Hello <span style="font-weight: bold;">world</span>! </p> </body> </html> </syntaxhighlight>
The rendering of that markup:
<html>
<body>
<p>Hello <span style="font-weight: bold;">world</span>!
</p>
</body>
</html>