User:Marcus/MediaWiki Quick Reference
This is a terse single-page reference for Nottinghack Wiki. For a gentler introduction, see the main guide to Using the Wiki.
System configuration
Nottinghack Wiki is powered by MediaWiki version 1.42.1. See more version information and the list of extensions, usage statistics and other SpecialPages.
Other sources of documentation
MediaWiki is the same software used by Wikipedia. The main documentation can be found in:
The content of this page has been compiled from the public domain materials in Project:PD help.
Basic text formatting
This markup can be used anywhere within a line of text, but you cannot start italics or bold on one line and close it on the next.
Description | You type | You get |
---|---|---|
Italic text | two aprostrophes for ''italic'' text |
two aprostrophes for italic text |
Bold text | three aprostrophes for '''bold''' text |
three aprostrophes for bold text |
Bold and italic | five aprostrophes for '''''bold & italic''''' text |
five aprostrophes for bold & italic text |
Escape wiki markup | <nowiki>no ''markup''</nowiki> |
no ''markup'' |
Section formatting
Section formatting can only be used at the beginning of a line.
Headings
Headings of different levels are created by surrounding the line with equal signs (=).
== Level 2 == === Level 3 === ==== Level 4 ==== ===== Level 5 ===== ====== Level 6 ======
For each heading in the wiki article an HTML anchor is automatically created. That makes it possible to create #Links to section headings.
Paragraphs
MediaWiki generally ignores single line breaks and joins consecutive lines of text together. To start a new paragraph, leave an empty line. To create a wide paragraph break, leave two empty lines. You can force a line break inside a paragraph with the HTML tag <br />
.
Description | You type | You get |
---|---|---|
Single line breaks are ignored | This text is joined together as if it were a single line. |
This text is joined together as if it were a single line. |
Empty lines define paragraphs
Note: Two empty lines give a larger paragraph break.
|
First paragraph. Second paragraph. The third paragraph will <br /> break in the middle. |
First paragraph. Second paragraph.
|
Other sections
Description | You type | You get | |
---|---|---|---|
Horizontal rule | Text above ---- Text below |
Text above Text below | |
Bullet list |
* Start each line * with an [[Wikipedia:asterisk|asterisk]] (*). ** More asterisks gives deeper *** and deeper levels. * Line breaks<br />don't break levels. *** But jumping levels creates empty space. Any other start ends the list. |
Any other start ends the list. | |
Numbered list |
# Start each line # with a [[Wikipedia:Number_sign|number sign]] (#). ## More number signs gives deeper ### and deeper ### levels. # Line breaks<br />don't break levels. ### But jumping levels creates empty space. # Blank lines # end the list and start another. Any other start also ends the list. |
Any other start also ends the list. | |
Definition list | ;item 1 : definition 1 ;item 2 : definition 2-1 : definition 2-2 |
| |
Mixture of different types of list |
# one # two #* two point one #* two point two # three ## three sub 1 ### three sub 1 sub 1 ## three sub 2 |
| |
Preformatted textTemplate:Anchor
Note: This way of preformatting only applies to section formatting. Character formatting markups are still effective.
|
Start each line with a space. Text is '''preformatted''' and character formatting is effective. |
Start each line with a space. Text is preformatted and character formatting is effective. |
|
Syntax Highlighting for code
Note: This will only work with the GeSHi extension.
|
<syntaxhighlight lang="cpp">#include <iostream> int main (int argc, char** argv) { cout << "Hello World!"; return 0; }</syntaxhighlight> |
#include <iostream>
int main (int argc, char** argv) {
cout << "Hello World!";
return 0;
}
| |
Poetry
Note: There is no easy way to display poems on this wiki yet.
|
: A programmer started to cuss,<br /> : Because getting to sleep was a fuss.<br /> : As he lay there in bed,<br /> : Looping ’round in his head,<br /> : Was: while(!asleep()) sheep++;<br /> :: — Author unknown |
|
HTML tags
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 |
---|---|---|
Underline | <u>Underline</u> |
Underline |
Strikethrough | <del>Strikethrough</del> or <s>Strikethrough</s> |
or
|
Monospaced text | <code>Source code</code> or <tt>Teletype text</tt> |
or Teletype text |
Size adjustments | <big>Larger text</big> <small>Smaller text</small> <small>Small text with <big>larger</big> text inside</small> <small><small>Really small text</small></small> |
Larger text Smaller text Small text with larger text inside Really small text |
Blockquotes | text above text above <blockquote>blockquote</blockquote> text below text below |
text above text above
text below text below |
Comment | <!-- This is a comment --> Comments are only visible in the edit window. |
Comments are only visible in the edit window. |
Completely preformatted text
Note: For marking up of preformatted text, check the "Preformatted text" entry at the bottom of the previous table.
|
<pre> Text is '''preformatted''' and ''markups'' '''''are''''' not effective.</pre> |
Text is '''preformatted''' and ''markups'' '''''are''''' not effective. |
HTML symbols
An HTML symbol entity is a sequence of characters that produces one particular character. For example, €
produces the Euro symbol "€
" and ™
produces trademark symbol "™
". HTML symbol entities are allowed in MediaWiki and are sometimes used in advanced editing for two main reasons: to insert characters not normally available on keyboards and to prevent the parser from interpreting and displaying HTML tags and symbols:
- &euro; → €
- <span style="color:green;">Green</span> → <span style="color:green;">Green</span>
The following is a list of characters that can be produced using HTML symbols. Hover any character to find out the symbol that produces it. Some symbols not available in the current font will appear as empty squares.
HTML Symbol Entities | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Á | á | Â | â | ´ | Æ | æ | À | à | ℵ | Α | α | & | ∧ | ∠ | Å | å | ≈ | Ã | ã | Ä | ä | „ | Β | β | ¦ | • | ∩ | Ç | ç | ¸ | ¢ |
Χ | χ | ˆ | ♣ | ≅ | © | ↵ | ∪ | ¤ | † | ‡ | ↓ | ⇓ | ° | Δ | δ | ♦ | ÷ | É | é | Ê | ê | È | è | ∅ | Ε | ε | ≡ | Η | η | ||
Ð | ð | Ë | ë | € | ∃ | ƒ | ∀ | ½ | ¼ | ¾ | ⁄ | Γ | γ | ≥ | > | ↔ | ⇔ | ♥ | … | Í | í | Î | î | ¡ | Ì | ì | ℑ | ∞ | ∫ | Ι | ι |
¿ | ∈ | Ï | ï | Κ | κ | Λ | λ | ⟨ | « | ← | ⇐ | ⌈ | “ | ≤ | ⌊ | ∗ | ◊ | | ‹ | ‘ | < | ¯ | — | µ | · | − | Μ | μ | ∇ | – | |
≠ | ∋ | ¬ | ∉ | ⊄ | Ñ | ñ | Ν | ν | Ó | ó | Ô | ô | Œ | œ | Ò | ò | ‾ | Ω | ω | Ο | ο | ⊕ | ∨ | ª | º | Ø | ø | Õ | õ | ⊗ | Ö |
ö | ¶ | ∂ | ‰ | ⊥ | Φ | φ | Π | π | ϖ | ± | £ | ′ | ″ | ∏ | ∝ | Ψ | ψ | " | √ | ⟩ | » | → | ⇒ | ⌉ | ” | ℜ | ® | ⌋ | Ρ | ρ | |
› | ’ | ‚ | Š | š | ⋅ | § | | Σ | σ | ς | ∼ | ♠ | ⊂ | ⊆ | ∑ | ⊃ | ¹ | ² | ³ | ⊇ | ß | Τ | τ | ∴ | Θ | θ | ϑ | Þ | þ | ˜ | |
× | ™ | Ú | ú | ↑ | ⇑ | Û | û | Ù | ù | ¨ | ϒ | Υ | υ | Ü | ü | ℘ | Ξ | ξ | Ý | ý | ¥ | ÿ | Ÿ | Ζ | ζ | | |
Mathematical formulae
It is not possible to display mathematical formulae at present, except by manually uploading images (See #Images).
Links
There are three sorts of links:
- Internal links to other pages in the wiki.
- External links to other websites.
- Interwiki links to other websites registered to the wiki in advance.
Internal links
To add an internal link, enclose the name of the page you want to link to in double square brackets. When you save the page, you'll see the new link pointing to your page. If the page exists already it is displayed in blue, if it does not, in red.
The first letter of the target page is automatically capitalized, unless otherwise set by the admins, and spaces are represented as underscores (typing an underscore in the link will have a similar effect as typing a space, but is not recommended, since the underscore will also be shown in the text).
Description | You type | You get |
---|---|---|
Internal link | [[Main Page]] |
Main Page |
Piped link
Note: See also Template:Mediawiki
|
[[Main Page|different text]] |
different text |
Hide namespace shortcut | [[Help:Contents|]] |
Contents |
word-ending links | [[Help]]s [[Help]]ing [[Help]]ers [[Help]]anylettersyoulikehere |
|
Redirect
Note: See also Help:Redirects
|
#REDIRECT [[Main Page]] |
→ Main Page |
Internal link to an anchor on the current page | [[#See also]] |
#See also |
Internal link to the current page's table of contents | [[#toc|Contents]] |
Contents |
Internal link to the top of the current page | [[#top|top]] |
top |
Internal link to an anchor from different text | [[#See also|different text]] |
different text |
Setting an internal link anchor
Note: Omit the "optional text" for invisible anchor.
Note: Headings are automatically anchored.
|
<div id="NameOfAnchorHere">optional text</div> |
optional text
|
Internal link to an anchor at another page | [[Help:Images#See also]] |
Help:Images#See also |
Internal link to the current page's talk page
Note: See also Help:Magic_words#Page_names
|
[[{{TALKPAGENAME}}|Discussion]] |
Discussion |
Internal link to the current page's edit page
Note: See also Help:Magic_words#URL_data and #External links
|
[{{fullurl:{{PAGENAME}}|action=edit}} Edit] |
Edit |
Internal link to a subpage
See also Help:Subpages. |
[[/example]] |
/example |
Internal link to a subpage without the leading slash | [[/example/]] |
example |
Internal link to a category page
Note: See also Help:Categories
|
[[:Category:Help]] |
Category:Help |
Internal link to an image or a file of other types
Note: See also Help:Images
|
[[media:example.jpg]] [[media:example.pdf]] |
media:example.jpg |
Internal link to the user's user page | [[Special:MyPage]] |
Special:MyPage |
Links to section headings
You can link directly to headings within a wiki page. MediaWiki automatically creates an HTML anchor with the same name as the heading.
Description | You type | You get |
---|---|---|
Links to section headings | [[#External links]] [[#Pitfalls!]] |
External links
Description | You type | You get |
---|---|---|
External link | http://mediawiki.org | http://mediawiki.org |
External link with different label | [http://mediawiki.org MediaWiki] | MediaWiki |
Numbered external link | [http://mediawiki.org] | [1] |
External links with file icons
Note: See currently supported icons.
|
[http://en.wikipedia.org/wiki/.avi video] [http://en.wikipedia.org/wiki/.ogg sound] [http://en.wikipedia.org/wiki/.pdf document] | |
External link to the same host | http://{{SERVERNAME}}/pagename | http://wiki.nottinghack.org.uk/pagename |
External link to other host passing the pagename | http://google.com/search?q={{PAGENAMEE}} | http://google.com/search?q=Marcus/MediaWiki_Quick_Reference |
Mailto link | [mailto:info@example.org email me] | email me |
Mailto named with subject line and body | [mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text info] | info |
External link icons
Test link | Icon | Trigger |
---|---|---|
[2] | external-link-ltr-icon.png | .external , http:// , gopher://
|
[3] | lock-icon.png | https://
|
[4] | mail-icon.png | mailto:
|
[5] | news-icon.png | news://
|
[6] | file-icon.png | ftp://
|
[7] | talk-icon.png | irc://
|
[8] | audio-icon.png | .ogg , .mid , .midi , .mp3 , .wav , .wma
|
[9] | video-icon.png | .ogm , .avi , .mpeg , .mpg
|
[10] | document-icon.png | .pdf , .pdf# , .pdf?
|
How to avoid auto-links
By default, when you write a URL as is, it will be transformed to an external link.
To avoid that effect, put the URL between <nowiki>
tags as in:
<nowiki>http://mediawiki.org</nowiki>
Interwiki links
Interwiki links are abbreviations for longer URLs. They allow you to link to an external wiki almost as if you are linking to a page on your own wiki. The external website must be registered in advance by an administrator.
For example, you can link to the Sunflower article on http://en.wikipedia.org by typing [[wikipedia:Sunflower]]
, which will result in a link wikipedia:Sunflower. This is because http://en.wikipedia.org/wiki/
is registered to Nottinghack Wiki by default with the prefix of wikipedia
. A similar link could be created as a normal external link by typing [http://en.wikipedia.org/wiki/Sunflower big yellow flower]
.
.
The default Interlink map can be found in [11].
Tables
Tables may be authored in wiki pages using either XHTML table elements directly, or using wikicode formatting to define the table. XHTML table elements and their use are well described on various web pages and will not be discussed here. The benefit of wikicode is that the table is constructed of character symbols which tend to make it easier to perceive the table structure in the article editing view compared to XHTML table elements.
As a general rule, it is best to avoid using a table unless you need one. Table markup often complicates page editing.
Wiki table markup summary
{| |
table start |
|+ |
table caption, optional; only between table start and first table row |
|- |
table row, optional on first row -- wiki engine assumes the first row |
! |
table header cell, optional. Consecutive table header cells may be added on same line separated by double marks (!! ) or start on new lines, each with its own single mark (! ).
|
| |
table data cell, required! Consecutive table data cells may be added on same line separated by double marks (|| ) or start on new lines, each with its own single mark (| ).
|
|} |
table end |
- The above marks must start on a new line except the double
||
and!!
for optionally adding consecutive cells to a line. However, blank spaces at the beginning of a line are ignored. - XHTML attributes. Each mark, except table end, optionally accepts one or more XHTML attributes. Attributes must be on the same line as the mark. Separate attributes from each other with a single space.
- Cells and caption (
|
or||
,!
or!!
, and|+
) hold content. So separate any attributes from content with a single pipe (|
). Cell content may follow on same line or on following lines. - Table and row marks (
{|
and|-
) do not directly hold content. Do not add pipe (|
) after their optional attributes. If you erroneously add a pipe after attributes for the table mark or row mark the parser will delete it and your final attribute if it was touching the erroneous pipe!
- Cells and caption (
- Content may (a) follow its cell mark on the same line after any optional XHTML attributes or (b) on lines below the cell mark. Content that uses wiki markup that itself needs to start on a new line, such as lists, headings, or nested tables, must be on its own new line.
- Pipe character as content. To insert a pipe (
|
) character into a table use the <nowiki>|
</nowiki> escaping markup
- Pipe character as content. To insert a pipe (
Basics
The following table lacks borders and good spacing but shows the simplest wiki markup table structure.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
The cells in the same row can be listed on one line separated by ||
(two pipe symbols). If the text in the cell contains a line break, use <br />
instead.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| |Orange||Apple||more |- |Bread||Pie||more |- |Butter||Ice<br />cream||and<br />more |} |
|
Extra spaces within cells in the wiki markup, as in the wiki markup below, do not affect the actual table rendering.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| | Orange || Apple || more |- | Bread || Pie || more |- | Butter || Ice cream || and more |} |
|
You can have longer text or more complex wiki syntax inside table cells, too:
You type | You get | ||
---|---|---|---|
{| |Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | * Lorem ipsum dolor sit amet * consetetur sadipscing elitr * sed diam nonumy eirmod tempor invidunt |} |
|
Table headers
Table headers can be created by using "!
" (exclamation mark) instead of "|
" (pipe symbol). Headers usually show up bold and centered by default.
You type | You get | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| ! Item ! Amount ! Cost |- |Orange |10 |7.00 |- |Bread |4 |3.00 |- |Butter |1 |5.00 |- !Total | |15.00 |} |
|
Caption
A table caption can be added to the top of any table as follows.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| |+Food complements |- |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
XHTML attributes
You can add XHTML attributes to tables. For the authoritative source on these, see the W3C's HTML 4.01 Specification page on tables.
Attributes on tables
Placing attributes after the table start tag ({|
) applies attributes to the entire table.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" align="center" style="text-align:center;" |Orange |Apple |12,333.00 |- |Bread |Pie |500.00 |- |Butter |Ice cream |1.00 |} |
|
Attributes on cells
You can put attributes on individual cells. For example, numbers may look better aligned right.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" |Orange |Apple |align="right" | 12,333.00 |- |Bread |Pie |align="right" | 500.00 |- |Butter |Ice cream |align="right" | 1.00 |} |
|
You can also use cell attributes when you are listing multiple cells on a single line. Note that the cells are separated by ||
, and within each cell the attribute(s) and value are separated by |
.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" | Orange || Apple || align="right" | 12,333.00 |- | Bread || Pie || align="right" | 500.00 |- | Butter || Ice cream || align="right" | 1.00 |} |
|
Attributes on rows
You can put attributes on individual rows, too.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" |Orange |Apple |align="right"|12,333.00 |- |Bread |Pie |align="right"|500.00 |- style="font-style:italic; color:green;" |Butter |Ice cream |align="right"|1.00 |} |
|
Simple one-pixel table border
The default table formatting uses the "border-collapse: separate" model, which adds table cell spacing (which also separates the table outer border from its content cells). Even with a zero cellspacing, the borders of consecutive cells (and of the overall table container) will add up, so to get a one-pixel separation between cells, you need to selectively remove one or more of the four borders of cells.
Such tables may be formatted more simply, using the "border-collapse: collapse" CSS property; in this table formatting model, the cellspacing attribute (or the CSS "border-spacing:" property) and the table's "padding:" CSS property is ignored and only the larger border of adjacent inner cells (or the table border for outer cells) will be used.
An example of the above for one-pixel table border, using each model (without need for external extensions):
You type | You get | ||||
---|---|---|---|---|---|
{|style="border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000; padding: 0" |- !style="border-style: solid; border-width: 0 1px 1px 0"| Orange !style="border-style: solid; border-width: 0 0 1px 0"| Apple |- |style="border-style: solid; border-width: 0 1px 0 0"| Bread |style="border-style: solid; border-width: 0"| Pie |} |
| ||||
{|style="border-collapse: collapse; border-width: 1px; border-style: solid; border-color: #000" |- !style="border-style: solid; border-width: 1px"| Orange !style="border-style: solid; border-width: 1px"| Apple |- |style="border-style: solid; border-width: 1px"| Bread |style="border-style: solid; border-width: 1px"| Pie |} |
|
Notes :
- When using the "border-width:" CSS shortcut property, the order of the four space-separated specified values is: top, right, bottom, left. As an example from above:
- "border-width: 0 1px 0 0"
- When there are fewer than 4 values, the value for left takes its default from the value for right, the value for bottom takes its default from the value for top, and the value for right takes its default from the value for top.
- The HTML attributes (such as "width=", "border=", "cellspacing=", "cellpadding=") do not need any length unit (the pixel unit is assumed). The CSS style properties (which override the HTML attributes) require an explicit length unit (if the value is not 0) such as "px" for the pixel.
HTML colspan and rowspan
You can use HTML colspan and rowspan attributes on cells for advanced layout.
You type | You get | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| border="1" !colspan="6"|Shopping List |- |rowspan="2"|Bread & Butter |Pie |Buns |Danish |colspan="2"|Croissant |- |Cheese |colspan="2"|Ice cream |Butter |Yoghurt |} |
|
With HTML attributes and CSS styles
CSS style attributes can be added with or without other HTML attributes.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| style="color:green; background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1" |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
Attributes can be added to the caption and headers as follows.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| border="1" cellpadding="20" cellspacing="0" |+ align="bottom" style="color:#e76700;" |''Food complements'' |- |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
Accessibility of table header cells
Table header cells do not explicitly specify which table data cells they apply to (those on their right on the same row, or those below them on the same column). When the table is rendered in a visual 2D environment, this is usually easy to infer.
However when tables are rendered on non-visual medias, you can help the browser to determine which table header cell applies to the description of any selected cell (in order to repeat its content in some accessibility helper) using a scope="row" or scope="col" attribute on table header cells. In most cases with simple tables, you'll use scope="col" on all header cells of the first row, and scope="row" on the first cell of the following rows:
You type | You get | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| border="1" cellspacing="0" cellpadding="2" |- !scope="col"| Item !scope="col"| Quantity !scope="col"| Price |- !scope="row"| Bread | 0.3 kg | $0.65 |- !scope="row"| Butter | 0.125 kg | $1.25 |- !scope="row" colspan="2"| Total | $1.90 |} |
|
Pitfalls!
Negative numbers
If you start a cell on a new line with a negative number with a minus sign (or a parameter that evaluates to a negative number), your table can get broken, because the characters |-
will be parsed as the wiki markup for table row, not table cell. To avoid this, insert a space before the value (| -6
) or use in-line cell markup (|| -6
).
Images
This section explains the image syntax used in the wiki. You or another user must usually upload an image before you can use it on a page.
Supported media types for images
The following file formats are supported by Mediawiki by default:
- .jpg or .jpeg : bitmap image compressed in the standard JPEG format (this lossy format is most suitable for photographs).
- .png : bitmap image in the Portable Network Graphics format (specified by the W3 Consortium).
- .gif : bitmap image in the legacy Graphics Interchange Format.
Another format commonly enabled on MediaWiki (but not yet supported on Nottinghack Wiki) is:
- .svg : scalable image in the Scalable Vector Graphics format (specified by the W3 Consortium).
Rendering a single image
Syntax
The full syntax for displaying an image is:
[[File:filename.extension|options|caption]]
The options can be given in any order separated by pipes (|):
- Format option:
frame
,frameless
orthumb
;- Controls how the rendered image is formatted and embedded in the rest of the page. See below.
- Resizing option: one of
- {width}
px
— Resizes the image to fit within the given maximum width in pixels, without restricting its height; x
{height}px
— Resizes the image to fit within the given maximum height in pixels, without restricting its width;- {width}
x
{height}px
— Resizes the image to fit within the given width and height in pixels; upright
— Resizes an image to fit within reasonable dimensions, according to user preferences (suitable for images in portrait orientation rather than landscape).
- Note: that the image will always retain its aspect ratio, and can only be reduced (not increased) in size unless it's in a scalable media type (bitmap images cannot be scaled up). The default maximum size depends on the format and the internal image dimensions (according to its media type).
- {width}
- Horizontal alignment option: one of
left
,right
,center
,none
;- Controls the horizontal alignment (and inline/block or floating styles) of the image within a text (no default value).
- Vertical alignment option: one of
baseline
,sub
,super
,top
,text-top
,middle
,bottom
, text-bottom;- Controls the vertical alignment of a non-floating inline image with the text before or after the image, and in the same block (the default vertical alignment is
middle
).
- Controls the vertical alignment of a non-floating inline image with the text before or after the image, and in the same block (the default vertical alignment is
- Link option: one of
link=
{target} — Allows to change the target (to an arbitrary page title, or URL) of the generated link associated with the image.Note:link
does not work withthumb
,thumbnail
orframe
.
- Other specific options:
border
— adds a very thin border around the image.alt=
{alternative text} — Defines the alternative text (maps to the HTML attributealt="..."
of the generated<image />
element) of an image that will be rendered if either the referenced image cannot be downloaded and embedded, or if the support media must use the alternative description text (e.g. when using a Braille reader or with accessibility options set by the user in its browser).page=
{number} — Renders the specified page number (currently only applicable when showing a .djvu or .pdf file).
If a parameter does not match any of the other possibilities, it is assumed to be the caption text. Caption text is shown below the image in thumb and frame formats, or as mouseover text in border and frameless formats or when the format is omitted. Caption text displayed in the thumb and frame formats may contain wiki links and other formatting. In the other options, wiki-formatting will not work. If no caption text is supplied, a caption is automatically created showing the file name. To completely remove the caption, set it to <span title=""></span>
.
Size and Frame
Among different formats, the effect of the size parameter may be different, as shown below.
- When the format is not specified the size can be both reduced and enlarged to any specified size.
- In the examples below, the original size of the image is 400 × 267 pixels.
- An image with
frame
always ignores the size specification, the original image will be reduced if it exceeds the maximum size defined in user preferences. - The size of an image with
thumb
can be reduced, but can not be enlarged beyond the original size of the image.
Format | Reduced | Enlarged |
---|---|---|
(not specified) |
[[File:MediaWiki:Image sample|50px]] |
|
[[File:MediaWiki:Image sample|500px]] |
| |
border |
[[File:MediaWiki:Image sample|border|50px]] |
|
[[File:MediaWiki:Image sample|border|500px]] |
| |
frame |
[[File:MediaWiki:Image sample|frame|50px]] |
|
[[File:MediaWiki:Image sample|frame|500px]] |
| |
thumb |
[[File:MediaWiki:Image sample|thumb|50px]] |
|
[[File:MediaWiki:Image sample|thumb|500px]] |
| |
frameless |
[[File:MediaWiki:Image sample|frameless|50px]] |
|
[[File:MediaWiki:Image sample|frameless|500px]] |
Horizontal alignment
Note that when using the frame
or thumb[nail]
formats, the default horizontal alignment will be right
.
Description | You type | You get |
---|---|---|
no horizontal alignment specified, or default alignment Rendered as a floating block: no Rendered inline: yes |
[[File:example.jpg|100px|caption]] |
|
specify horizontal alignment as: none Rendered as a floating block: no Rendered inline: no |
[[File:example.jpg|none|100px|caption]] |
|
specify horizontal alignment as: center Rendered as a floating block: no Rendered inline: no |
[[File:example.jpg|center|100px|caption]] |
|
specify horizontal alignment as: left Rendered as a floating block: yes Rendered inline: no |
[[File:example.jpg|left|100px|caption]] |
|
specify horizontal alignment as: right Rendered as a floating block: yes Rendered inline: no |
[[File:example.jpg|right|100px|caption]] |
Vertical alignment
The vertical alignment options take effect only if the image is rendered as an inline element and is not floating. They alter the way the inlined image will be vertically aligned with the text present in the same block before and/or after this image on the same rendered row. Note that the rendered line of text where inline images are inserted (and the lines of text rendered after the current one) may be moved down (this will increase the line-height conditionally by additional line spacing, just as it may occur with spans of text with variable font sizes, or with superscripts and subscripts) to allow the image height to be fully displayed with this alignment constraint.
To show the alignment result more clearly in this example, the text spans are overlined and underlined, the line-height is increased and emphasized with a yellow background and grey border:
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|40px|border|top]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|40px|border|text-top]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
<sup>super:</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|40px|border|super]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|40px|border|baseline]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
<sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|40px|border|sub]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''default:''' [[File:Example.jpg|20px]][[File:Example.jpg|40px]] [[File:Example.jpg|40px|border]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|40px|border|middle]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|40px|border|text-bottom]]
<del>text</del></u></span></p>
<p style="border:1px solid #AAA;background:#FF9;padding:0;font-size:150%;line-height:2">
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
'''bottom:'' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|40px|border|bottom]]
<del>text</del></u></span></p>
Stopping the text flow
On occasion it is desirable to stop text (or other inline non-floating images) from flowing around a floating image. Depending on the web browser's screen resolution and such, text flow on the right side of an image may cause a section header (for instance, == My Header ==) to appear to the right of the image, instead of below it, as a user may expect. The text flow can be stopped by placing <br style="clear: both" /> before the text that should start below the floating image.
All images rendered as blocks (including non-floating centered images, left- or right-floating images, as well as framed or thumbnailed floating images) are implicitly breaking the surrounding lines of text (terminating the current block of text before the image, and creating a new paragraph for the text after them). They will then stack vertically along their left or right alignment margin (or along the center line between these margins for centered images).
Altering the default link target
The following table shows how to alter the link target (whose default is the image description page) or how to remove it. Changing the link does not alter the format described in the previous sections.
Description | You type | You get |
---|---|---|
internal link |
[[File:example.jpg|link=Main Page|caption]] |
|
external link |
[[File:example.jpg|link=http://wikipedia.org|caption]] |
|
no link (external or file page) |
[[File:example.jpg|link=|caption]] |
|
Rendering a gallery of images
Gallery syntax
It's easy to make a gallery of thumbnails only, not other images, with the <gallery>
tag. The syntax is:
<gallery> Image:file_name.ext|caption Image:file_name.ext|caption {...} </gallery>
Note that the image code is not enclosed in brackets when enclosed in gallery tags.
Captions are optional, and may contain wiki links or other formatting.
for example:
<gallery> File:Example.jpg|Item 1 File:Example.jpg|a link to [[Help:Contents]] File:Example.jpg File:Example.jpg File:Example.jpg| ''italic caption'' File:Example.jpg|on page "{{PAGENAME}}" </gallery>
is formatted as:
-
Item 1
-
a link to Help:Contents
-
italic caption
-
on page "Marcus/MediaWiki Quick Reference"
Optional gallery attributes
The gallery tag itself takes several additional parameters, specified as attribute name-value pairs:
<gallery {parameters}> {images} </gallery>
caption={caption}
: sets a caption on the gallery.widths={width}px
: sets the widths of the images, default 120px. Note the plural, widthsheights={heights}px
: sets the (max) heights of the images.perrow={integer}
: sets the number of images per row.showfilename={anything}
: Show the filenames of the images in the individual captions for each image (1.17+)
Example:
Coding:
<gallery widths=60px heights=60px perrow=7 caption="sunflowers are groovy"> File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg </gallery>
Result:
Linking to an image without displaying it
Link to description page
If you put a colon (:
) before File:
, the image will not be embedded and the link will lead to the description page of the file.
[[:File:MediaWiki:Image sample]] [[:File:MediaWiki:Image sample|Sunflowers]]
results in
[[:File:MediaWiki:Image sample]] [[:File:MediaWiki:Image sample|Sunflowers]]
Link to another page
This will make a 50px width picture with a link to the page MediaWiki:
[[File:Wiki.png|50px|link=MediaWiki]]
Link directly to the media file
You can use the pseudo-namespace “Media” to link directly to a file without rendering it, bypassing the description page.
[[Media:MediaWiki:Image sample]] [[Media:MediaWiki:Image sample|Sunflowers]]
results in
[[Media:MediaWiki:Image sample]] [[Media:MediaWiki:Image sample|Sunflowers]]
You can also use:
[[Special:FilePath/MediaWiki:Image sample]]
which can be used to link to a potential file, even if it doesn't exist. You can also use:
{{FILEPATH:MediaWiki:Image sample}}
which generates an external URL to the file inline:
Files at other websites
You can link to an external file available online using the same syntax used for linking to an external web page. With these syntaxes, the image will not be rendered, but only the text of the link to this image will be displayed.
[http://url.for/some/image.png]
Or with a different displayed text:
[http://url.for/some/image.png link text here]
Additional MediaWiki markup or HTML/CSS formatting (for inline elements) is permitted in this displayed text (with the exception of embedded links that would break the surrounding link):
[http://www.example.com/some/image.png Example '''<del>rich</del>''' ''<ins>link text</ins>'' here.]
which renders as: Example rich link text here.
If it is enabled on your wiki (see Template:Mediawiki), you can also embed external images. To do that, simply insert the image's url:
http://url.for/some/image.png
Currently, embedded images cannot be resized, but they may be formatted by surrounding MediaWiki markup or HTML/CSS code.
If this wiki option is not enabled, the image will not be embedded but rendered as a textual link to the external site, just like above.
Categories
Templates
Magic Words
Wishlist
This is a list of extensions and changes that would improve Nottinghack's MediaWiki. These extensions are very stable and widely used:
Critical
- Install ParserFunctions. These are really useful, and without them you can only create very basic templates. I would like to use them to get the templates to work on this page.
Essential
Every tech wiki needs these:
- Enable the
<math>
features built into MediaWiki (See [12]), so we can display formulae. - The SyntaxHighlight GeSHi extension for code samples.
Desirables
- The <poem> extension makes it possible to write poem-like text without a mass of <br /> tags.
- If possible, an extension to display the Interwiki map - at the moment we have to guess.
- The widgets extention would let us embed maps, youtube videos, the flickr gallery, etc.
- Inline SVG support, so we can display diagrams. Even better would be an inline SVG editor, so we can collaborate on them.