Difference between revisions of "Help:Wiki markup"

From CAMEO
Jump to navigation Jump to search
Line 1: Line 1:
 
{{Wiki markup}}
 
{{Wiki markup}}
  
{{shortcut|H:MARKUP|H:WIKICODE|WP:MARKUP}}
+
The contents of this page were copied from Wikipedia Help:Wiki markup.  Any embedded internal links are for the Wikipedia site. These will be corrected eventually.
  
'''Wiki markup''' is the syntax and keywords used by the [[MediaWiki]] software to format a page. A short intro is at [[Help:Cheatsheet]]. To learn how to see this markup and to save an edit, see: [[Help:Editing]].
+
'''Wiki markup''' is the syntax and keywords used by the MediaWiki software to format a page.  
  
 
{{TOC limit}}
 
{{TOC limit}}
Line 16: Line 16:
 
The <code>=</code> through <code>======</code> markup are headings for the sections with which they are associated.
 
The <code>=</code> through <code>======</code> markup are headings for the sections with which they are associated.
 
* A single = is styled as the article title and should not be used within an article.
 
* A single = is styled as the article title and should not be used within an article.
* Headings are styled through [[CSS]] and add an <code>[edit]</code> link.
+
* Headings are styled through CSS and add an <code>[edit]</code> link.
 
* Four or more headings cause a table of contents to be generated automatically.
 
* Four or more headings cause a table of contents to be generated automatically.
 
* Do not use <em>any</em> markup after the final heading markup – this will either break the heading, or will cause the heading to not be included in an edit summary.
 
* Do not use <em>any</em> markup after the final heading markup – this will either break the heading, or will cause the heading to not be included in an edit summary.
Line 30: Line 30:
 
And so on.
 
And so on.
  
Wiki headings translate to [[HTML]] [[HTML element#h1|heading element]]s, {{tag|h1|o}} through {{tag|h6|o}}, styled as follows by default:
+
Wiki headings translate to HTML, styled as follows by default:
 
 
{{#lst:Help:HTML in wikitext|HTML_section}}
 
  
 
Templates: {{tl|fake heading}} for use in documentation
 
Templates: {{tl|fake heading}} for use in documentation
  
 
==== Horizontal rule ====
 
==== Horizontal rule ====
{{see|WP:LINE}}
 
  
 
The horizontal rule represents a paragraph-level thematic break. Do not use in article content.
 
The horizontal rule represents a paragraph-level thematic break. Do not use in article content.
Line 50: Line 47:
  
 
==== Table of contents ====
 
==== Table of contents ====
{{see|WP:TOC}}
+
 
  
 
When a page has at least four headings, a table of contents (TOC) will automatically appear after the lead and before the first heading. The TOC can be controlled by magic words or templates:
 
When a page has at least four headings, a table of contents (TOC) will automatically appear after the lead and before the first heading. The TOC can be controlled by magic words or templates:
Line 57: Line 54:
 
* <code><nowiki>__NOTOC__</nowiki></code> disables the TOC entirely.
 
* <code><nowiki>__NOTOC__</nowiki></code> disables the TOC entirely.
 
* {{tl|TOC limit}} can be used to control the depth of subsections included in the TOC. This is useful where the TOC is long and unwieldy.
 
* {{tl|TOC limit}} can be used to control the depth of subsections included in the TOC. This is useful where the TOC is long and unwieldy.
* [[:Category:Wikipedia table of contents templates]] contains a number of specialized TOC templates.
+
* Category:Wikipedia table of contents templates contains a number of specialized TOC templates.
  
 
=== Line breaks ===
 
=== Line breaks ===
{{see|Wikipedia:Line-break handling|Wikipedia:Don't use line breaks}}
 
  
 
Line breaks or newlines are used to add whitespace between lines, such as separating paragraphs.
 
Line breaks or newlines are used to add whitespace between lines, such as separating paragraphs.
Line 93: Line 89:
  
 
=== Indent text ===
 
=== Indent text ===
{{see|WP:INDENT}}
+
 
  
 
Indentation is most commonly used on talk pages.
 
Indentation is most commonly used on talk pages.
Line 118: Line 114:
 
}}
 
}}
  
Templates: {{tl|outdent}}, {{tl|outdent2}}
 
  
 
=== Blockquote ===
 
=== Blockquote ===
Line 140: Line 135:
 
}}
 
}}
  
Template {{tl|center}} uses the same markup. To center a table, see [[Help:Table#Centering tables]].
+
Template {{tl|center}} uses the same markup. To center a table, see Wikipedia Help:Table#Centering tables.
  
 
===Align text to right===
 
===Align text to right===
Line 150: Line 145:
  
 
=== Lists ===
 
=== Lists ===
{{see|Help:List|MOS:LIST}}
+
 
  
 
Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.
 
Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.
Line 204: Line 199:
  
 
==== {{Anchor|DL}}Definition lists ====
 
==== {{Anchor|DL}}Definition lists ====
{{Shortcut|H:DL}}
 
  
 
To list terms and definitions, start a new line with a semicolon (;) followed by the term. Then, type a colon (:) followed by a definition.
 
To list terms and definitions, start a new line with a semicolon (;) followed by the term. Then, type a colon (:) followed by a definition.
Line 210: Line 204:
 
Definition lists consist of group names corresponding to values. Group names (terms) are in bold. Values (definitions) are indented. Each group <em>must</em> include one or more definitions. For a single or first value, the <code>:</code> can be placed on the same line after <code>;</code> – but subsequent values must be placed on separate lines.
 
Definition lists consist of group names corresponding to values. Group names (terms) are in bold. Values (definitions) are indented. Each group <em>must</em> include one or more definitions. For a single or first value, the <code>:</code> can be placed on the same line after <code>;</code> – but subsequent values must be placed on separate lines.
  
{{hatnote|Do not use a semicolon (;) simply to bold a line without defining a value using a colon (:). This usage renders invalid [[HTML5]].}}
+
Do not use a semicolon (;) simply to bold a line without defining a value using a colon (:). This usage renders invalid HTML5.
  
 
{{markup
 
{{markup
Line 231: Line 225:
 
HTML: {{tag|dl|o}} {{tag|dt}}, {{tag|dd}} {{tag|dl|c}}
 
HTML: {{tag|dl|o}} {{tag|dt}}, {{tag|dd}} {{tag|dl|c}}
  
Templates: {{tl|defn}}
 
  
 
=== Retaining newlines and spaces ===
 
=== Retaining newlines and spaces ===
{{shortcut|H:POEM}}
+
 
  
 
The MediaWiki software suppresses single newlines and converts lines starting with a space to preformatted text in a dashed box. HTML suppresses multiple spaces. It is often desirable to retain these elements for poems, lyrics, mottoes, oaths and the like. The [[mw:Extension:Poem|Poem]] extension adds HTML-like {{tag|poem}} tags to maintain newlines and spaces. These tags may be used inside other tags such as {{tag|blockquote}}. [[H:CSS|CSS styles]] may be applied to this tag, e.g.: <code><nowiki><poem style="margin-left: 2em;"></nowiki></code>.
 
The MediaWiki software suppresses single newlines and converts lines starting with a space to preformatted text in a dashed box. HTML suppresses multiple spaces. It is often desirable to retain these elements for poems, lyrics, mottoes, oaths and the like. The [[mw:Extension:Poem|Poem]] extension adds HTML-like {{tag|poem}} tags to maintain newlines and spaces. These tags may be used inside other tags such as {{tag|blockquote}}. [[H:CSS|CSS styles]] may be applied to this tag, e.g.: <code><nowiki><poem style="margin-left: 2em;"></nowiki></code>.
Line 412: Line 405:
  
 
==== Egyptian hieroglyphs ====
 
==== Egyptian hieroglyphs ====
{{main|Help:WikiHiero syntax}}
+
Go to Wikipedia at main|Help:WikiHiero syntax
  
WikiHiero is a software extension that renders [[Egyptian hieroglyphs]] as PNG images using {{xtag|hiero}} tags.
+
WikiHiero is a software extension that renders Egyptian hieroglyphs as PNG images using {{xtag|hiero}} tags.
  
 
Example:
 
Example:
Line 423: Line 416:
  
 
==== Chess symbols ====
 
==== Chess symbols ====
{{main|Chess symbols in Unicode}}
+
Go to Wikipedia at main|Chess symbols in Unicode
  
 
==== Diacritical marks ====
 
==== Diacritical marks ====
  
* See [[Help:Special characters]].
+
* See Help:Special characters.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 530: Line 523:
  
 
==== Subscripts and superscripts ====
 
==== Subscripts and superscripts ====
 +
* See Help:Scripts
  
* The [[Wikipedia:Manual of Style (mathematics)#Superscripts and subscripts|Manual of Style]] prefers the <em><nowiki>x<sub>1</sub></nowiki></em> format.
+
* The Wikipedia:Manual of Style (mathematics)#Superscripts and subscripts|Manual of Style prefers the <em><nowiki>x<sub>1</sub></nowiki></em> format.
 
* The latter methods of sub/superscripting cannot be used in the most general context, as they rely on Unicode support which may not be present on all users' machines. For the 1, 2, 3 superscripts, it is nevertheless preferred when possible (as with units of measurement) because most browsers have an easier time formatting lines with it.
 
* The latter methods of sub/superscripting cannot be used in the most general context, as they rely on Unicode support which may not be present on all users' machines. For the 1, 2, 3 superscripts, it is nevertheless preferred when possible (as with units of measurement) because most browsers have an easier time formatting lines with it.
  

Revision as of 14:10, 13 September 2013

Wiki markup

The contents of this page were copied from Wikipedia Help:Wiki markup. Any embedded internal links are for the Wikipedia site. These will be corrected eventually.

Wiki markup is the syntax and keywords used by the MediaWiki software to format a page.

TOC limit

Layout

Sections

Section headings

See

The = through ====== markup are headings for the sections with which they are associated.

  • A single = is styled as the article title and should not be used within an article.
  • Headings are styled through CSS and add an [edit] link.
  • Four or more headings cause a table of contents to be generated automatically.
  • Do not use any markup after the final heading markup – this will either break the heading, or will cause the heading to not be included in an edit summary.

Markup And so on.

Wiki headings translate to HTML, styled as follows by default:

Templates: Tl for use in documentation

Horizontal rule

The horizontal rule represents a paragraph-level thematic break. Do not use in article content.

Markup

HTML: Tag

Table of contents

When a page has at least four headings, a table of contents (TOC) will automatically appear after the lead and before the first heading. The TOC can be controlled by magic words or templates:

  • __FORCETOC__ forces the TOC to appear at the normal location regardless of the number of headings.
  • __TOC__ forces the TOC to appear at the point where the magic word is inserted instead of the normal location.
  • __NOTOC__ disables the TOC entirely.
  • Tl can be used to control the depth of subsections included in the TOC. This is useful where the TOC is long and unwieldy.
  • Category:Wikipedia table of contents templates contains a number of specialized TOC templates.

Line breaks

Line breaks or newlines are used to add whitespace between lines, such as separating paragraphs.

  • A line break that is visible in the content is inserted by pressing Key press twice.
  • Pressing Key press once will place a line break in the markup, but it will not show in the rendered content, except when using list markup.
  • Markup such as bold or italics will be terminated at a line break.

Markup

HTML: Tag or Tag

Templates:

  • Tl adds multiple line breaks.
  • Tl adds a true carriage return and line feed.
  • Tl adds a break with styling to clear floating elements.
  • Tl creates an unbulleted list.

Indent text

Indentation is most commonly used on talk pages.

Markup


Blockquote

When there is a need for separating a block of text. This is useful for (as the name says) inserting blocks of quoted (and cited) text. Markup

Center text

Markup

Template Tl uses the same markup. To center a table, see Wikipedia Help:Table#Centering tables.

Align text to right

Markup

Lists

Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.

Unordered lists

Markup

Ordered lists

Markup

AnchorDefinition lists

To list terms and definitions, start a new line with a semicolon (;) followed by the term. Then, type a colon (:) followed by a definition.

Definition lists consist of group names corresponding to values. Group names (terms) are in bold. Values (definitions) are indented. Each group must include one or more definitions. For a single or first value, the : can be placed on the same line after ; – but subsequent values must be placed on separate lines.

Do not use a semicolon (;) simply to bold a line without defining a value using a colon (:). This usage renders invalid HTML5.

Markup

HTML: Tag Tag, Tag Tag


Retaining newlines and spaces

The MediaWiki software suppresses single newlines and converts lines starting with a space to preformatted text in a dashed box. HTML suppresses multiple spaces. It is often desirable to retain these elements for poems, lyrics, mottoes, oaths and the like. The Poem extension adds HTML-like Tag tags to maintain newlines and spaces. These tags may be used inside other tags such as Tag. CSS styles may be applied to this tag, e.g.: <poem style="margin-left: 2em;">.

Markup

Format

Text formatting

Description What you type What it looks like

Italics, bold, Smallcaps.

To ''italicize text'', just put
2 apostrophes on each side.

3 apostrophes will '''bold the text'''

5 apostrophes for '''''bold italics'''''

'''''Italic and bold
formatting''''' only works properly
within a single line.

For text as {{Smallcaps|small caps}},
that uses a [[Help:Template|template]].

To italicize text, just put 2 apostrophes on each side.

3 apostrophes will bold the text

5 apostrophes for bold italics

Italic and bold formatting only works properly within a single line.

For text as Smallcaps, that uses a template.

Small chunks of source code within a line of normal text.

Code is displayed in a monospace font.

function <code>int m2()</code> is nice

function int m2() is nice

Syntax highlighting for source code.

Computer code has colored text and more stringent formatting. For example, to define a function: int m2(), with highlights.

<syntaxhighlight lang="cpp">
#include <iostream>
int m2 (int ax, char *p_ax) {
  std::cout <<"Hello World!";
  return 0;
}</syntaxhighlight>
#include <iostream>
int m2 (int ax, char *p_ax) {
  std::cout <<"Hello World!";
  return 0;
}

Small text.

Use <small>small text</small> if needed.

A span tag can set text font-size as
being <span style="font-size: 87%">87%
of prior size</span>, to match an
image caption.

Use small text if needed.

A span tag can set text font-size as being 87% of prior size, to match an image caption.

Big text.

Better not use <big>big text</big>,
unless <small> it's <big>within</big>
small</small> text.

Better not use big text, unless it's within small text.

You can include a non-breaking space (sometimes called non-printing character) where you require two words to always appear together on the same line, such as Mr. Smith or 400 km/h, using &nbsp; in place of a regular space between the two "words" that need to behave as a single word (never be separated on different lines).

Mr.&nbsp;Smith or 400&nbsp;km/h.

Mr. Smith or 400 km/h.

Extra spacing within text can best be achieved using the pad template.

Mary {{pad|4em}} had a little lamb.

Mary Pad had a little lamb.

Typewriter font.

(Also works beyond the end of a paragraph.)

<tt>arrow      &rarr;</tt>

<tt>''italics'', '''bold'''</tt>

<tt>[[link]]

New paragraph </tt>started here.

arrow →

italics, bold

Link

New paragraph started here.

Special characters

Egyptian hieroglyphs

Go to Wikipedia at main|Help:WikiHiero syntax

WikiHiero is a software extension that renders Egyptian hieroglyphs as PNG images using Xtag tags.

Example: Markup

Chess symbols

Go to Wikipedia at main|Chess symbols in Unicode

Diacritical marks

  • See Help:Special characters.
What you type What it looks like
&Agrave; &Aacute; &Acirc; &Atilde; &Auml; &Aring; &AElig;

&Ccedil; &Egrave; &Eacute; &Ecirc; &Euml;

&Igrave; &Iacute; &Icirc; &Iuml; &Ntilde;

&Ograve; &Oacute; &Ocirc; &Otilde; &Ouml; &Oslash; &OElig;

&Ugrave; &Uacute; &Ucirc; &Uuml; &Yuml; &szlig;

&agrave; &aacute; &acirc; &atilde; &auml; &aring; &aelig; &ccedil;

&egrave; &eacute; &ecirc; &euml;

&igrave; &iacute; &icirc; &iuml; &ntilde;

&ograve; &oacute; &ocirc; &otilde; &ouml; &oslash; &oelig;

&ugrave; &uacute; &ucirc; &uuml; &yuml;

À Á Â Ã Ä Å Æ

Ç È É Ê Ë

Ì Í Î Ï Ñ

Ò Ó Ô Õ Ö Ø Œ

Ù Ú Û Ü Ÿ ß

à á â ã ä å æ ç

è é ê ë

ì í î ï ñ

ò ó ô õ ö ø œ

ù ú û ü ÿ

Punctuation, special characters

What you type What it looks like
&iquest; &iexcl; &sect; &para;

&dagger; &Dagger; &bull; &ndash; &mdash;

&lsaquo; &rsaquo; &laquo; &raquo;

&lsquo; &rsquo; &ldquo; &rdquo;

&apos; &quot;

¿ ¡ § ¶

† ‡ • – —

‹ › « »

‘ ’ “ ”

' "

Other punctuation, escaping special characters

The [[#Pre|Tag]] and [[#Nowiki|Tag]] markup tags are also available. (For writing "[", "{", "&", "}", "]", for example.)

Commercial symbols

What you type What it looks like
&trade; &copy; &reg; 

&cent; &euro; &yen; &pound; &curren;

™ © ®

¢ € ¥ £ ¤

Subscripts and superscripts

  • See Help:Scripts
  • The Wikipedia:Manual of Style (mathematics)#Superscripts and subscripts|Manual of Style prefers the x<sub>1</sub> format.
  • The latter methods of sub/superscripting cannot be used in the most general context, as they rely on Unicode support which may not be present on all users' machines. For the 1, 2, 3 superscripts, it is nevertheless preferred when possible (as with units of measurement) because most browsers have an easier time formatting lines with it.
Description What you type What it looks like

Subscripts

x<sub>1</sub> x<sub>2</sub> x<sub>3</sub> or

x&#8320; x&#8321; x&#8322; x&#8323; x&#8324;

x&#8325; x&#8326; x&#8327; x&#8328; x&#8329;

x1 x2 x3 or

x₀ x₁ x₂ x₃ x₄

x₅ x₆ x₇ x₈ x₉

Superscripts

x<sup>1</sup> x<sup>2</sup> x<sup>3</sup> or

x&#8304; x&sup1; x&sup2; x&sup3; x&#8308;

x&#8309; x&#8310; x&#8311; x&#8312; x&#8313;

x1 x2 x3 or

x⁰ x¹ x² x³ x⁴

x⁵ x⁶ x⁷ x⁸ x⁹

Combined

&epsilon;<sub>0</sub> = 8.85 &times; 10<sup>&minus;12</sup> C&sup2; / J m

1 [[hectare]] = [[1 E+4 m&sup2;]]

ε0 = 8.85 × 10−12 C² / J m

1 Hectare = 1 E+4 m²

Greek characters

What you type What it looks like
&alpha; &beta; &gamma; &delta; &epsilon; &zeta;

&eta; &theta; &iota; &kappa; &lambda; &mu; &nu;

&xi; &omicron; &pi; &rho; &sigma; &sigmaf;

&tau; &upsilon; &phi; &chi; &psi; &omega;

&Alpha; &Beta; &Gamma; &Delta; &Epsilon; &Zeta;

&Eta; &Theta; &Iota; &Kappa; &Lambda; &Mu;

&Nu; &Xi; &Omicron; &Pi; &Rho; &Sigma;

&Tau; &Upsilon; &Phi; &Chi; &Psi; &Omega;

α β γ δ ε ζ

η θ ι κ λ μ ν

ξ ο π ρ σ ς

τ υ φ χ ψ ω

Α Β Γ Δ Ε Ζ

Η Θ Ι Κ Λ Μ

Ν Ξ Ο Π Ρ Σ

Τ Υ Φ Χ Ψ Ω


Contents