Help:Basic MediaWiki Syntax: Difference between revisions

From Computer History Wiki
Jump to navigationJump to search
New page: <div align="center"> {| style="border:1px solid #A3B1BF; text-align:left; background:#f5faff" |-<!--COLUMN HEADINGS--> | width="25%" style="background: #cee0f2; padding: 0.3em; text-align:...
 
Syntax for additional anchors (link targets)
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This is a brief introduction to MediaWiki [[source]] syntax. For a more comprehensive guide, see [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents here].
__NOTOC__
==Text==
<div align="center">
<div align="center">
{| style="border:1px solid #A3B1BF; text-align:left; background:#f5faff"
{| style="border:1px solid #A3B1BF; text-align:left; background:#f5faff"
Line 33: Line 37:
|-
|-
|Internal link<br />
|Internal link<br />
(within Wikipedia)
(within the Computer History wiki)<br />
''This, and the one above, can be combined.''
|
|
<tt><nowiki>[[name of page]]</nowiki></tt><br />
<tt><nowiki>[[name of page]]</nowiki></tt><br />
<tt><nowiki>[[name of page|display text]]</nowiki></tt><br />
<tt><nowiki>[[name of page|display text]]</nowiki></tt><br />
<tt><nowiki>[[name of page#heading]]</nowiki></tt><br />
|
|
[[name of page]]<br />
[[name of page]]<br />
[[name of page|display text]]<br />
[[name of page|display text]]<br />
[[name of page#heading]]<br />
|-
|-
|colspan="3" style="border-top:1px solid #cee0f2;"|
|colspan="2"|<span style="font-size:0.9em>''Wikipedia style, followed here, is generally to only link the '''first''' instance of a term on a page.''<br />
|-
''See below for the syntax for adding additional anchors (link targets).''</span>
|Redirect to another page
|
<tt><nowiki>#REDIRECT [[Target page]]</nowiki></tt>
|
<big>&#8627;</big> [[Target page]]
|-
|-
|colspan="3" style="border-top:1px solid #cee0f2;"|
|colspan="3" style="border-top:1px solid #cee0f2;"|
|-
|-
|External link<br />
|External link<br />
(to other websites)
(to other websites)<br />
''The middle one is '''much''' preferred.''
|
|
<tt><nowiki>[http://www.example.org]</nowiki></tt><br />
<tt><nowiki>[http://www.example.org]</nowiki></tt><br />
Line 63: Line 66:
|-
|-
|colspan="3" style="border-top:1px solid #cee0f2;"|
|colspan="3" style="border-top:1px solid #cee0f2;"|
|-
|
Text can be commented out
|
matching <nowiki><!--</nowiki> and <nowiki>--></nowiki> around text to be ignored
|-
|-
|
|
Line 73: Line 81:
{{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC)  
{{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC)  
|-<!--2ND HEADING-->
|-<!--2ND HEADING-->
| colspan="3" style="background:#E6F2FF; padding: 0.2em; font-family: sans-serif; font-size: 0.9em; text-align:center;" | Applies only at the beginning of the line
| colspan="3" style="background:#E6F2FF; padding: 0.2em; font-family: sans-serif; font-size: 0.9em; text-align:center;" | Items below only apply at the beginning of a line
|-
|-
|Headings<br />
|Headings<br />
<span style="font-size:0.9em;">''A Table of Contents will automatically be generated when four headings are added to an article.''</span>
<span style="font-size:0.9em;">''A Table of Contents will automatically be generated when four headings are added to an article.''</span>
<span style="font-size:0.9em;">''For a reason that has been lost in the mists of time, Wikipedia (and thus here) uses '==' as the top level section marker; '=' seems to work now, but please keep up the style.''</span>
|
|
<tt><nowiki>== Level 1 ==</nowiki></tt><br />
<tt><nowiki>== Level 1 ==</nowiki></tt><br />
Line 84: Line 94:
<tt><nowiki>====== Level 5 ======</nowiki></tt>
<tt><nowiki>====== Level 5 ======</nowiki></tt>
|
|
__TOC__
== Level 1 ==
== Level 1 ==
=== Level 2 ===
=== Level 2 ===
Line 89: Line 101:
===== Level 4 =====
===== Level 4 =====
====== Level 5 ======
====== Level 5 ======
|-
|colspan="3" style="border-top:1px solid #cee0f2;"|
|-
|Indented items<br />
''(used mostly on Talk: pages)''
|
<tt>: foo</tt><br />
<tt>:: bar</tt><br />
|
: foo
:: bar
|-
|-
|colspan="3" style="border-top:1px solid #cee0f2;"|
|colspan="3" style="border-top:1px solid #cee0f2;"|
Line 117: Line 140:
## two point one
## two point one
# three
# three
|}
</div>
To add additional anchors (link targets) at arbitrary locations inside an article, use the following syntax:
''<nowiki><span id="Anchor">Optional text</span></nowiki>''
These anchors can be used in both internal and external links.
==Pre-formatted text==
There are a number of ways to include pre-formatted text (e.g. [[source code]] fragments); all of these techniques also use a fixed-width [[font]] for the text:
* Start each line with a space character; normal markups can be used; e.g.:
<nowiki>" This is '''pre-formatted''' text"</nowiki>
produces:
This is '''pre-formatted''' text
* Use the [[Hypertext Markup Language|HTML]] <nowiki><nowiki></nowiki> tag, with a space character before the <nowiki><nowiki></nowiki>. (Remember to add a matching closing tag after the pre-formatted text block).
* Use the HTML <nowiki><pre></nowiki> tag (again, remember the closing tag).
Note that the HTML <nowiki><blockquote></nowiki> tag only indents the block; text within it will still be justified.
==Tables==
<pre>
{| class="wikitable" style="text-align: center;"
! Table !! Prototype
|-
| colspan="2" | Headers
|-
| aa || rowspan="2" | yy
|-
| bb
|-
| cc || zz
|}
</pre>
produces:
{| class="wikitable" style="text-align:center;"
! Table !! Prototype
|-
| colspan="2" | Headers
|-
| aa || rowspan="2" | yy
|-
|-
|colspan="3" style="border-top:1px solid #cee0f2;"|&nbsp;
| bb
|-
|-
|Thumbnail image
| cc || zz
|
<nowiki>[[Image:Pdp-11-40.jpg|thumb|Caption text]]</nowiki>
|
[[Image:Pdp-11-40.jpg|thumb|Caption text]]
|}
|}
</div>
 
==Images==
 
Including the special form:
 
<nowiki>[[File:Pdp1115.jpg|thumb|150px|left|Caption text]]</nowiki>
 
produces:
 
[[File:Pdp1115.jpg|thumb|150px|left|Caption text]]
 
(The legacy keyword 'Image' may be used in place of "File".) Leaving out the "150px" inserts the image full-size. The optional keywords 'left' and 'right' can be added to control the horizontal placement.
 
(Notice that this text fills up around the image. Add a <nowiki><br clear=all></nowiki> after the image line to force the text to re-start below the image.)
 
New images can be uploaded via the 'Upload file' page (link on the left-hand side of all pages).
 
A lengthy tutorial on images is [https://en.wikipedia.org/wiki/Help:Pictures here]; complete specifications for the use of the 'File' special form are available [https://en.wikipedia.org/wiki/Wikipedia:Extended_image_syntax here] and [https://www.mediawiki.org/wiki/Help:Images here].
<br clear=all>
==See also==
 
* [https://www.mediawiki.org/wiki/Help:Contents MediaWiki.org help pages] - a wealth of detail
** [https://www.mediawiki.org/wiki/Help:Formatting Help:Formatting] - detailed help on formatting
** [https://www.mediawiki.org/wiki/Help:Tables Help:Tables] - ditto for tables
 
[[Category: Help]]

Latest revision as of 15:30, 24 July 2025

This is a brief introduction to MediaWiki source syntax. For a more comprehensive guide, see here.

Text

Description You type You get
Applies anywhere
Italicise text

''italic''

italic

Bold text

'''bold'''

bold

Bold and italic

'''''bold & italic'''''

bold & italic

Internal link

(within the Computer History wiki)
This, and the one above, can be combined.

[[name of page]]
[[name of page|display text]]
[[name of page#heading]]

name of page
display text
name of page#heading

Wikipedia style, followed here, is generally to only link the first instance of a term on a page.

See below for the syntax for adding additional anchors (link targets).

External link

(to other websites)
The middle one is much preferred.

[http://www.example.org]
[http://www.example.org display text]
http://www.example.org

[1]
display text
http://www.example.org

Text can be commented out

matching <!-- and --> around text to be ignored

Sign your posts
on talk pages

~~~~

Your username 22:39,
8 October 2026 (UTC)

Items below only apply at the beginning of a line
Headings

A Table of Contents will automatically be generated when four headings are added to an article.

For a reason that has been lost in the mists of time, Wikipedia (and thus here) uses '==' as the top level section marker; '=' seems to work now, but please keep up the style.

== Level 1 ==
=== Level 2 ===
==== Level 3 ====
===== Level 4 =====
====== Level 5 ======

Level 1

Level 2

Level 3

Level 4
Level 5
Indented items

(used mostly on Talk: pages)

: foo
:: bar

foo
bar
Bullet list

* one
* two
** two point one
* three

  • one
  • two
    • two point one
  • three
Numbered list

# one
# two
## two point one
# three

  1. one
  2. two
    1. two point one
  3. three

To add additional anchors (link targets) at arbitrary locations inside an article, use the following syntax:

<span id="Anchor">Optional text</span>

These anchors can be used in both internal and external links.

Pre-formatted text

There are a number of ways to include pre-formatted text (e.g. source code fragments); all of these techniques also use a fixed-width font for the text:

  • Start each line with a space character; normal markups can be used; e.g.:

" This is '''pre-formatted''' text"

produces:

This is pre-formatted text
  • Use the HTML <nowiki> tag, with a space character before the <nowiki>. (Remember to add a matching closing tag after the pre-formatted text block).
  • Use the HTML <pre> tag (again, remember the closing tag).

Note that the HTML <blockquote> tag only indents the block; text within it will still be justified.

Tables

{| class="wikitable" style="text-align: center;"
! Table !! Prototype
|-
| colspan="2" | Headers
|-
| aa || rowspan="2" | yy
|-
| bb
|-
| cc || zz
|}

produces:

Table Prototype
Headers
aa yy
bb
cc zz

Images

Including the special form:

[[File:Pdp1115.jpg|thumb|150px|left|Caption text]]

produces:

Caption text

(The legacy keyword 'Image' may be used in place of "File".) Leaving out the "150px" inserts the image full-size. The optional keywords 'left' and 'right' can be added to control the horizontal placement.

(Notice that this text fills up around the image. Add a <br clear=all> after the image line to force the text to re-start below the image.)

New images can be uploaded via the 'Upload file' page (link on the left-hand side of all pages).

A lengthy tutorial on images is here; complete specifications for the use of the 'File' special form are available here and here.

See also