Help:Wiki markup

(Redirected from H:DL)

Wiki markup, also known as wikitext or wikicode, consists of the syntax and keywords used by the MediaWiki software to format a page. To learn how to see this markup, and to save an edit, see: Help:Editing. There is a short list of markup and tips at Help:Cheatsheet.


Layout

change

Instructions on this page may not work with Wikipedia:VisualEditor. The directions on this page are mainly for manual editing in the Change tab. For instructions on editing with VisualEditor, see that guideline.

Sections

change

Sections in a page will follow the page's lead (introduction section).

Markup

change

Use the == (two equal signs) markup for headings (also called section titles), not the ''' (triple apostrophes) used to make words appear bold in character formatting. Start with ==, add the heading title, then end with ==.

This section’s heading was created by writing:

== Sections and headings ==

This subsection’s heading was created by writing:

=== Subsection ===

This sub-subsection’s heading was created by writing:

==== Sub-subsection ====
And so on.

Table of contents

change

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 the following Magic words and 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.
  • {{TOC limit}} can be used to control the depth of subsections included in the TOC. This is useful where the TOC is long might confuse readers.

Line breaks

change

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

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

HTML equivalent: <br> or <br />

Templates:

  • {{break}} adds multiple line breaks.
  • {{-}} and {{clear}} adds a break with styling, to clear floating elements.
  • {{plainlist}} and {{unbulleted list}} both create an unbulleted list.

Indent text

change

Indentation as used on Talk pages:

:Each [[Colon (punctuation)|]] at the start of a line
::causes the line to be indented by three more character positions.
:::(The indentation persists
so long as no [[carriage return]] or line break is used.)
:::Repeat the indentation at any line break.
::::Use an extra colon for each response.
:::::And so forth ...

However, the colons do not show in the text and looks like this:

Each colon at the start of a line
causes the line to be indented by three more character positions.
(The indentation persists

so long as no carriage return or line break is used.)

Repeat the indentation at any line break.
Use an extra colon for each response.
And so forth ...
And so on ...


Templates:
{{od}} returns an outdent (opposite of an indent) response (after the fourth, fifth, or so indent) to start the next response:

:::::And so forth...
{{od}}And so on...

Looks like this:

And so forth ...

┌─────────────────────────────────┘
And so on...

Blockquote

change

Is used when there is a need for separating a block of text (text that is grouped together). This is useful for (as the name says) inserting blocks of quoted (and cited) text. The editor provides any quotation marks.

<blockquote>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</blockquote>

Looks like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.


Related templates:

  • {{Cquote}} will also indent both margins but will add large blue quotation marks:

Looks like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
  • {{Rquote}} is for shorter quotes of 50 or 100 words. It will align text to the left margin and add large blue quotation marks:
  • See Related pages for more quotation templates.

Align text to right

change

You can align content in a separate container:

<div style="text-align: right; direction: ltr; margin-left: 1em;"> You can safely experiment with this markup string in the sandbox

Looks like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

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

Unordered lists

change

An unordered list shows items in no particular order:

* Item1
* Item2
* Item3
* Item4
** Sub-item 4 a)
*** Sub-item 4 a) 1.
**** Sub-item 4 a) 1. i)
**** Sub-item 4 a) 1. ii)
** Sub-item 4 b)
* Item5

Looks like this:

  • Item1
  • Item2
  • Item3
  • Item4
    • Sub-item 4 a)
      • Sub-item 4 a) 1.
        • Sub-item 4 a) 1. i)
        • Sub-item 4 a) 1. ii)
    • Sub-item 4 b)
  • Item5

Ordered lists

change

An ordered list shows items numerical order or order of importance:

# Item1
# Item2
# Item3
# Item4
## Sub-item 1
### Sub-sub-item
#### Sub-sub-sub-item
## Sub-item 2
# Item5

Looks like this:

  1. Item1
  2. Item2
  3. Item3
  4. Item4
    1. Sub-item 1
      1. Sub-sub-item
        1. Sub-sub-sub-item
    2. Sub-item 2
  5. Item5

Description lists

change

To list terms and definitions, start a new line with a semicolon (;) followed by the term. Then, type a colon (:) followed by a definition. The format can also be used for other purposes, such as make and models of vehicles, etc.

Description lists (formerly definition lists, and a.k.a. association 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 and creates issues with screen readers.

; Term : Definition1

Looks like this:

Term
Definition1


; Term
: Definition1
: Definition2
: Definition3
: Definition4

Looks like this:

Term
Definition1
Definition2
Definition3
Definition4

Format

change

Text formatting

change
Description What you type What it looks like

italics, bold, small capital letters

To ''italicize text'', put two 
consecutive apostrophes on each side 
of it.

Three apostrophes each side will 
'''bold the text'''.

Five consecutive apostrophes on each 
side (two for italics plus three for 
bold) produces '''''bold italics'''''.

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

For text as {{smallcaps|small caps}}, 
use the template {{tl|smallcaps}}.

To italicize text, put two consecutive apostrophes on each side of it.

Three apostrophes each side will bold the text.

Five consecutive apostrophes on each side (two for italics plus three for bold) produces bold italics.

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

For text as small caps, use the template {{smallcaps}}.

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> only 
when necessary.

Use small text only when necessary.

a <small> span

To match, for example, the font-size 
used in an [[Help:Visual file 
markup#Caption|image caption]], 
the "small" tag can also be used to 
<small style="font-size:87%;">reduce 
a text's font-size to 87%</small>.

To match, for example, the font-size used in an image caption, the "small" tag can also be used to reduce a text's font-size to 87%.

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.

To prevent two words from becoming separated by a linewrap (e.g. Mr. Smith or 400 km/h) a non-breaking space, sometimes also called a "non-printing character", may be used between them. (For three or more words, the template {{nowrap}} is probably more suitable.)

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

Mr. Smith or 400 km/h

Extra spacing within text is usually best achieved using the {{pad}} template.

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

Mary   had a little lamb.

Special characters

change

Special characters can often be displayed using numeric character references or character entity references. See Character encodings in HTML for more information. For example &Agrave; and &#xC0; both render À (A-grave). Percent-encoding can't be used, as it only works in URLs.

Diacritical marks

change

Diacritic marks, using character entity references.

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

change

Using character entity references.

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;

¿ ¡ § ¶

† ‡ • – —

‹ › « »

‘ ’ “ ”

' "

The <nowiki> and <pre> tags

change

The <nowiki> and <pre>markup tags are also available, for writing "[", "{", "&", "}", "]" for example. These tags prevent these characters from being recognized as wiki markup. They also prevent templates from running.

An example of <nowiki>...</nowiki>:

A singular <nowiki /> can be used to break wikimarkup.

  • Markup such as *, #, ; and : only and always take effect at the beginning of a line. A <nowiki /> before the markup will cause the characters to not parse as markup.
  • An internal link immediately followed by characters are blended to form a single link. Where this is not desired, add a <nowiki /> after the link.

Commercial symbols

change

Using character entity references.

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

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

™ © ®

¢ € ¥ £ ¤

Greek characters

change

Using character entity references.

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

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

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

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

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

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

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

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

α β γ δ ε ζ

Α Β Γ Δ Ε Ζ

η θ ι κ λ μ ν

Η Θ Ι Κ Λ Μ Ν

ξ ο π ρ σ ς

Ξ Ο Π Ρ Σ

τ υ φ χ ψ ω

Τ Υ Φ Χ Ψ Ω

Subscripts and superscripts

change
  • It is preferable to use the <sub> (subscript) and <sup> (superscript) formats. For example x<sub>1</sub>.
  • The methods below 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.
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

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

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

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

1 hectare = 1 E+4 m²

Mathematical characters and formulae

change

Mathematical characters

change
What you type What it looks like
&int; &sum; &prod; &radic;

&minus; &plusmn; &infin;

&asymp; &prop; &equiv; &ne;

&le; &ge;

&times; &middot; &divide; &part;

&prime; &Prime;

&nabla; &permil; &deg; &there4; &alefsym;

&oslash;

&isin; &notin; &cap; &cup;

&sub; &sup; &sube; &supe;

&not; &and; &or; &exist; &forall;

&rArr; &lArr; &dArr; &uArr; &hArr;

&rarr; &darr; &uarr; &larr; &harr;

∫ ∑ ∏ √

− ± ∞

≈ ∝ ≡ ≠

≤ ≥

× · ÷ ∂

′ ″

∇ ‰ ° ∴ ℵ

ø

∈ ∉ ∩ ∪

⊂ ⊃ ⊆ ⊇

¬ ∧ ∨ ∃ ∀

⇒ ⇐ ⇓ ⇑ ⇔

→ ↓ ↑ ← ↔

Simple tables

change

Lines that start with blank spaces in the editing window are shown in a box, like this:

A line with a blank space in front of it.

Many lines with a space in front will create a table, like this:

line 1
line 2
line 3

A line that contains only a blank space inserts a blank line into the table.

line 1

line 2

For a complete guide to more complex tables see Help:Tables.