MediaWiki User Guide/Text Formatting

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The following is an overview of text formatting available in Mediawiki:

Basic text formatting
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[edit | edit source]

Text formatting can also be done using HTML and CSS. Some of the most useful HTML elements are:

Most needed HTML markup
Task Markup Note
Preformatted text
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>Longer passage.</blockquote>
<!-- 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[edit | edit source]

Source 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">
    <p>Hello <span style="font-weight: bold;">world</span>!

The rendering of that markup:

    <p>Hello <span style="font-weight: bold;">world</span>!

Bibliography[edit | edit source]