Difference between revisions of "Help:Wiki markup"

From CAMEO
Jump to navigation Jump to search
Line 19: Line 19:
  
 
|<nowiki>== Section ==</nowiki>
 
|<nowiki>== Section ==</nowiki>
|
+
 
 
|<nowiki>=== Subsection ===</nowiki>
 
|<nowiki>=== Subsection ===</nowiki>
  

Revision as of 14:23, 13 September 2013

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.

Layout

Sections

Section headings

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.


|== Section ==

|=== Subsection ===

|==== Sub-subsection ==== |

And so on.

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

Horizontal rule

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


|---- |


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.
  • 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.

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 return 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.

A single newline has no effect on the layout. But an empty line starts a new paragraph, or ends a list or an indented part.

A single newline has no effect on the layout.

But an empty line starts a new paragraph, or ends a list or an indented part.

Indent text

Indentation is most commonly used on talk pages.


|Indentation as used on talk pages: :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 ... |Indentation as used on talk pages:

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 ...

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.

|<blockquote> The '''blockquote''' tag will indent both margins when needed instead of the left margin only as the colon does. </blockquote>

|

The blockquote tag will indent both margins when needed instead of the left margin only as the colon does.

Center text

|<div class="center" style="width: auto; margin-left: auto; margin-right: auto;">Centered text</div>

|2=

Centered text


Also see Wikipedia Help:Table#Centering tables.

Align text to right

|<div style="text-align: right; direction: ltr; margin-left: 1em;">Text on the right</div>

|2=

Text on the right

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

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