Difference between revisions of "Help:Formatting"

From eLinux.org
Jump to: navigation, search
m (1 revision(s))
m (Reverted edits by 117.254.126.246 (Talk) to last revision by MaxSem)
Line 3: Line 3:
  
 
== Text formatting markup ==
 
== Text formatting markup ==
 +
 
{| class="wikitable"
 
{| class="wikitable"
! style="width:15%" |Description
+
! Description !! You type !! You get
! style="width:45%" |You type
 
! style="width:40%" |You get
 
 
|-
 
|-
! colspan="3" align="center" style="background:#A7C1F2" | character formatting - ''applies anywhere''
+
! colspan="3" style="background:#ABE" | character (inline) formatting ''applies anywhere''
 
|-
 
|-
 
|Italic text
 
|Italic text
|<pre>''italic''</pre>
+
| <code><nowiki>''italic''</nowiki></code>
 
|''italic''
 
|''italic''
 
|-
 
|-
 
| Bold text
 
| Bold text
|<pre>'''bold'''</pre>
+
| <code><nowiki>'''bold'''</nowiki></code>
 
|'''bold'''
 
|'''bold'''
 
|-
 
|-
 
| Bold and italic
 
| Bold and italic
|<pre>'''''bold & italic'''''</pre>
+
| <code><nowiki>'''''bold & italic'''''</nowiki></code>
 
|'''''bold & italic'''''
 
|'''''bold & italic'''''
 
|-
 
|-
 
|Escape wiki markup
 
|Escape wiki markup
|
+
| <code><nowiki><nowiki>no ''markup''&lt;/nowiki></nowiki></code>
<pre>&lt;nowiki>no ''markup''</nowiki></pre>
 
 
|<nowiki>no ''markup''</nowiki>
 
|<nowiki>no ''markup''</nowiki>
 
|-
 
|-
! colspan="3" align="center" style="background:#A7C1F2"| section formatting - ''only at the beginning of the line''
+
! colspan="3" style="background:#ABE" | section formatting ''only at the beginning of the line''
 
|-
 
|-
 
|Headings of different levels  
 
|Headings of different levels  
|
+
| <pre>=level 1=
<pre>=level 1=
 
 
==level 2==
 
==level 2==
 
===level 3===
 
===level 3===
Line 37: Line 34:
 
=====level 5=====
 
=====level 5=====
 
======level 6======</pre>
 
======level 6======</pre>
An article with four or more headings will automatically create a [http://en.wikipedia.org/wiki/Wikipedia:Section#Table_of_contents_.28TOC.29 table of contents].
+
An article with 4 or more headings automatically creates a [[wikipedia:Wikipedia:Section#Table of contents (TOC)|table of contents]].
  
Use of a level 1 heading is '''''highly discouraged''''' as it appears with the same formatting and size as the page title, which can be confusing.
+
|<!-- hack to prevent TOC viewing for h1 - h6 elements: their style is hardcopied here -->
|
+
<div style="font-size: 188%; margin: 0; padding-top: .5em; padding-bottom: .17em; border-bottom: 1px solid #aaa">Level 1</div>
<!-- little hack to prevent TOC viewing -->
+
<div style="font-size: 150%; margin: 0; padding-top: .5em; padding-bottom: .17em; border-bottom: 1px solid #aaa">Level 2</div>
<div style="font-size: 188%; margin: 0; padding-top: .5em; padding-bottom: .17em; border-bottom: 1px solid #aaa;">Level 1</div>
+
<div style="font-size: 132%; font-weight: bold">Level 3</div><!--
<div style="font-size: 150%; margin: 0; padding-top: .5em; padding-bottom: .17em; border-bottom: 1px solid #aaa;">Level 2</div>
+
--><b>Level 4</b><!--
<div style="font-size: 132%; border-bottom: none; font-weight: bold;">Level 3</div>
+
--><div style="font-size: 86%; font-weight: bold">Level 5</div><!--
<div style="font-size: 100%; border-bottom: none; font-weight: bold;">Level 4</div>
+
--><b style="font-size: 80%">Level 6</b>
<div style="font-size: 86%; border-bottom: none; font-weight: bold;">Level 5</div>
 
<div style="font-size: 80%; border-bottom: none; font-weight: bold;">Level 6</div>
 
 
|-
 
|-
 
|Horizontal rule
 
|Horizontal rule
|
+
| <code>----</code>
<pre>----</pre>
 
 
|
 
|
 
----
 
----
Line 76: Line 70:
 
<pre>
 
<pre>
 
# one
 
# one
# two<br />spanning several lines<br />without breaking the numbering
+
# two<br />spanning more lines<br />doesn't break numbering
 
# three
 
# three
 
## three point one
 
## three point one
Line 83: Line 77:
 
|
 
|
 
# one
 
# one
# two<br />spanning several lines<br />without breaking the numbering
+
# two<br />spanning more lines<br />doesn't break numbering
 
# three
 
# three
 
## three point one
 
## three point one
Line 89: Line 83:
 
|-
 
|-
 
|Definition list
 
|Definition list
|
+
|<pre>
<pre>
 
 
;item 1
 
;item 1
:definition 1
+
: definition 1
 
;item 2
 
;item 2
:definition 2-1
+
: definition 2-1
:definition 2-2
+
: definition 2-2
 
</pre>
 
</pre>
 
|
 
|
 
;item 1
 
;item 1
:definition 1
+
: definition 1
 
;item 2
 
;item 2
:definition 2-1
+
: definition 2-1
:definition 2-2
+
: definition 2-2
 
|-
 
|-
 
| Adopting definition list to indent text
 
| Adopting definition list to indent text
 
|
 
|
<pre>:Single indent
+
<pre>: Single indent
::Double indent
+
:: Double indent
:::::Multiple indent</pre>
+
::::: Multiple indent</pre>
This adoption may be controversial from the viewpoint of accessibility.
+
This workaround may be controversial from the viewpoint of accessibility.
 
|
 
|
:Single indent
+
: Single indent
::Double indent
+
:: Double indent
:::::Multiple indent
+
::::: Multiple indent
 
|-
 
|-
 
| Mixture of different types of list
 
| Mixture of different types of list
Line 133: Line 126:
 
### five sub 1 sub 1
 
### five sub 1 sub 1
 
## five sub 2
 
## five sub 2
 +
 
;item 1
 
;item 1
 
:* definition 1-1
 
:* definition 1-1
Line 141: Line 135:
 
:# definition 2-2
 
:# definition 2-2
 
</pre>
 
</pre>
The usage of <code>#:</code> and <code>*:</code> for breaking a line within an item may also be controversial.
+
The usage of <code>#:</code> and <code>*:</code> for breaking a line within an item may also be controversial.
 
|
 
|
 
# one
 
# one
Line 153: Line 147:
 
#: four def one
 
#: four def one
 
#: this rather looks like the continuation of <code># four</code>
 
#: this rather looks like the continuation of <code># four</code>
#: and thus often used instead of <code><nowiki><br /></nowiki></code>
+
#: often used instead of <code>&lt;br /></code>
 
# five
 
# five
 
## five sub 1
 
## five sub 1
Line 182: Line 176:
  
 
== Paragraphs ==
 
== Paragraphs ==
MediaWiki ignores normal line breaks. To start a new paragraph, leave an empty line. You can force a line break within a paragraph with the HTML tags <code><nowiki><br /></nowiki></code>.
+
MediaWiki ignores normal line breaks. To start a new paragraph, leave an empty line. You can force a line break within a paragraph with the HTML tags <code>&lt;br /></code>.
  
 
== HTML ==
 
== HTML ==
Some [[wikipedia:HTML|HTML]] tags are allowed in MediaWiki, for example <code><nowiki><code></nowiki></code>, <code><nowiki><div></nowiki></code>, <code><nowiki><span></nowiki></code> and <code><nowiki><font></nowiki></code>. These apply anywhere you insert them.
+
Some [[wikipedia:HTML|HTML]] tags are allowed in MediaWiki, for example <code>&lt;code></code>, <code>&lt;div></code>, <code><nowiki><span></nowiki></code> and <code><nowiki><font></nowiki></code>. These apply anywhere you insert them.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 192: Line 186:
 
!You get
 
!You get
 
|-
 
|-
 +
| Strikethrough
 +
| <code>&lt;del>Strikethrough&lt;/del></code> or <code>&lt;s>Strikethrough&lt;/s></code>
 +
|<del>Strikethrough</del>
 +
|- style="white-space:nowrap"
 
|Fixed width text
 
|Fixed width text
|
+
| <code>&lt;tt>Fixed width text&lt;/tt></code> or <code>&lt;code>source code&lt;/code></code>
<pre><tt>Fixed width text</tt></pre>
+
| <tt>Fixed width text</tt>
|
 
<tt>Fixed width text</tt>
 
 
|-
 
|-
 
|Blockquotes
 
|Blockquotes
|
+
| <code>
<pre>
 
 
text text text text text text text text text text text text
 
text text text text text text text text text text text text
 
text text text text text text text text text text text text
 
text text text text text text text text text text text text
<blockquote>  quote quote quote quote quote quote </blockquote>
+
&lt;blockquote>  quote quote quote quote quote quote &lt;/blockquote>
 
text text text text text text text text text text text text
 
text text text text text text text text text text text text
</pre>
+
</code>
 +
| text text text text text text text text text text text text text text text text text text text text text text text text <blockquote>  quote quote quote quote quote quote </blockquote> text text text text text text text text text text text text
 +
|-
 +
|Comment
 +
| <code>&lt;!-- This is a comment --></code>
 +
Text can only be viewed in the edit window.
 
|
 
|
text text text text text text text text text text text text
+
<!-- This is a real invisible comment -->
text text text text text text text text text text text text
 
<blockquote> quote quote quote quote quote quote </blockquote>
 
text text text text text text text text text text text text
 
 
|-
 
|-
|Comment
+
|Completely preformatted text
 +
|
 +
<code><nowiki><pre>this way, all markups are '''ignored'''</pre></nowiki></code>
 
|
 
|
<pre><!--This is comment--></pre>
+
<pre> this way, all markups are '''ignored'''.</pre>
 
|
 
|
<!--This is comment-->
 
 
|-
 
|-
|Completely preformatted text
+
|'''Customised''' preformatted text
 
|
 
|
<pre><pre>this way, all markups are '''ignored'''&lt;/pre></pre>
+
<code><nowiki><pre style="CSS text">this way, all markups are '''ignored''' and formated with a CSS text</pre></nowiki></code>
 
|
 
|
<pre>
+
<pre style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;overflow:auto;">
this way, all markups are '''ignored'''</pre>
+
this way for instance, all '''ignored''' markups take into account the navigator size, by automatically adding some carriage returns dynamically to it.</pre>
 
|}
 
|}
 +
 
{{Admin tip|tip=If you trust your users you can allow full HTML by setting <code>{{mediawiki|Manual:$wgRawHtml|$wgRawHtml}} = true;</code> in {{mediawiki|Manual:LocalSettings.php|LocalSettings.php}}.}}
 
{{Admin tip|tip=If you trust your users you can allow full HTML by setting <code>{{mediawiki|Manual:$wgRawHtml|$wgRawHtml}} = true;</code> in {{mediawiki|Manual:LocalSettings.php|LocalSettings.php}}.}}
  
 
== Other formatting ==
 
== Other formatting ==
 
Beyond the text formatting markup shown above, here are some other formatting references:
 
Beyond the text formatting markup shown above, here are some other formatting references:
 +
 
*[[Help:Links|Links]]
 
*[[Help:Links|Links]]
*[[Help:Images|Images]]
+
* [[Help:Images|Images]]
*[[Help:Tables|Tables]]
+
* [[Help:Tables|Tables]]
  
 
{{Languages}}
 
{{Languages}}
  
 
[[Category:Help|Formatting]]
 
[[Category:Help|Formatting]]

Revision as of 20:14, 22 November 2009

PD Important note: When you edit this page, you agree to release your contribution into the public domain. If you don't want this or can't do this because of license restrictions, please don't edit. This page is one of the Public Domain Help Pages, which can be freely copied into fresh wiki installations and/or distributed with MediaWiki software; see Help:Contents for an overview of all pages. See Project:PD help/Copying for instructions. PD

You can format your text using wiki markup. This consists of normal characters like asterisks, single quotes or equation marks which have a special function in the wiki, sometimes depending on their position. For example, to format a word in italic, you include it in two single quotes like ''this''

Text formatting markup

Description You type You get
character (inline) formatting – applies anywhere
Italic text ''italic'' italic
Bold text '''bold''' bold
Bold and italic '''''bold & italic''''' bold & italic
Escape wiki markup <nowiki>no ''markup''</nowiki> no ''markup''
section formatting – only at the beginning of the line
Headings of different levels
=level 1=
==level 2==
===level 3===
====level 4====
=====level 5=====
======level 6======

An article with 4 or more headings automatically creates a table of contents.

Level 1
Level 2
Level 3
Level 4
Level 5
Level 6
Horizontal rule ----
Bullet list
* one
* two
* three
** three point one
** three point two

Inserting a blank line will end the first list and start another.

  • one
  • two
  • three
    • three point one
    • three point two
Numbered list
# one
# two<br />spanning more lines<br />doesn't break numbering
# three
## three point one
## three point two
  1. one
  2. two
    spanning more lines
    doesn't break numbering
  3. three
    1. three point one
    2. three point two
Definition list
;item 1
: definition 1
;item 2
: definition 2-1
: definition 2-2
item 1
definition 1
item 2
definition 2-1
definition 2-2
Adopting definition list to indent text
: Single indent
:: Double indent
::::: Multiple indent

This workaround may be controversial from the viewpoint of accessibility.

Single indent
Double indent
Multiple indent
Mixture of different types of list
# one
# two
#* two point one
#* two point two
# three
#; three item one
#: three def one
# four
#: four def one
#: this rather looks like the continuation of # four
#: and thus often used instead of <br />
# five
## five sub 1
### five sub 1 sub 1
## five sub 2

;item 1
:* definition 1-1
:* definition 1-2
:
;item 2
:# definition 2-1
:# definition 2-2

The usage of #: and *: for breaking a line within an item may also be controversial.

  1. one
  2. two
    • two point one
    • two point two
  3. three
    three item one
    three def one
  4. four
    four def one
    this rather looks like the continuation of # four
    often used instead of <br />
  5. five
    1. five sub 1
      1. five sub 1 sub 1
    2. five sub 2
item 1
  • definition 1-1
  • definition 1-2
item 2
  1. definition 2-1
  2. definition 2-2
Preformatted text
 preformatted text is done with
 a '''space''' at the 
 ''beginning'' of the line

This way of preformatting only applies to section formatting, and character formatting markups are still effective.

preformatted text is done with
a space at the 
beginning of the line

Paragraphs

MediaWiki ignores normal line breaks. To start a new paragraph, leave an empty line. You can force a line break within a paragraph with the HTML tags <br />.

HTML

Some HTML tags are allowed in MediaWiki, for example <code>, <div>, <span> and <font>. These apply anywhere you insert them.

Description You type You get
Strikethrough <del>Strikethrough</del> or <s>Strikethrough</s> Strikethrough
Fixed width text <tt>Fixed width text</tt> or <code>source code</code> Fixed width text
Blockquotes

text text text text text text text text text text text text text text text text text text text text text text text text <blockquote> quote quote quote quote quote quote </blockquote> text text text text text text text text text text text text

text text text text text text text text text text text text text text text text text text text text text text text text

quote quote quote quote quote quote

text text text text text text text text text text text text
Comment <!-- This is a comment -->

Text can only be viewed in the edit window.

Completely preformatted text

<pre>this way, all markups are '''ignored'''</pre>

 this way, all markups are '''ignored'''.
Customised preformatted text

<pre style="CSS text">this way, all markups are '''ignored''' and formated with a CSS text</pre>

 this way for instance, all '''ignored''' markups take into account the navigator size, by automatically adding some carriage returns dynamically to it.
Tools.svg Tip for wiki admins: If you trust your users you can allow full HTML by setting $wgRawHtml = true; in LocalSettings.php.

Other formatting

Beyond the text formatting markup shown above, here are some other formatting references:

Language: English