Wikipedia:GLAM/University of Toronto Libraries/Resources/Wiki markup
Going in
This page will cover:
- What you need to know about Wiki markup (or Wikitext) to edit comfortably enough in most situations
- Topics are broken out by task (e.g. formatting, linking, communicating with other editors) and include exercises
- Tips and tricks for making Wiki markup editing work for you
This page will be useful if:
- You have mostly edited Wikipedia (or some other Wikimedia project) with the Visual Editor, and have limited experience with the text (source) editor
- You find the source view of Wikimedia projects confusing or complicated
- You are somewhat familiar with the content, but wish to revisit it or just want some practice
- You're a Wiki markup master but you've stepped away for six years and would like a refresher
To try some DIY exercises, you will need:
- This page, for reference
- A page in your sandbox where you can practise
- Copy over the contents of User:Utl_jung/sandbox/LD40807try
- To make a new sandbox page, simply "create a new file" by writing /something after /sandbox in the URL
- For example: https://en.wikipedia.org/wiki/User:Utl_jung/sandbox/workinghour1 allows me to start that page
Basics
Wiki markup (or Wikitext) is one of many lightweight markup languages (LML) that prioritise human readability.
- Wiki markup works across all MediaWiki-based platforms, including all Wikimedia projects and other wikis built on MediaWiki
- Wikibase, the software behind Wikidata, is a specially developed instance of MediaWiki and also uses Wiki markup (e.g. today's working hour page)
- We are editing on Wikipedia today because Wikipedia allows us the luxury of a sandbox!
- Technically, Wikitext refers to text snippets or documents written in the Wiki markup language. But many use the terms interchangeably.
- Other LMLs include Markdown and GitHub Flavored Markdown.
- By comparison, HTML allows you to do more things but compromises on human readability.
Here is a table demonstrating how Wiki Markup compares to HTML (from Wiki#Basic syntax):
class="wikitable noprint" |
style="width:33.3%;"|MediaWiki syntax (the "behind the scenes" code used to add formatting to text)
! style="width:33.3%;"|Equivalent HTML (another type of "behind the scenes" code used to add formatting to text) ! style="width:33.3%;"|Rendered output (seen onscreen by a regular web user) |
---|
style="vertical-align:top;"
| "I've had nothing yet," Alice replied in an offended tone, "so I can't take more." "You mean you can't take less," said the Hatter. "It's very easy to take more than nothing." | "Take some more tea," the March Hare said to Alice, very earnestly. "I've had nothing yet," Alice replied in an offended tone, "so I can't take more." "You mean you can't take less," said the Hatter. "It's very easy to take more than nothing." |"Take some more tea," the March Hare said to Alice, very earnestly. "I've had nothing yet," Alice replied in an offended tone, "so I can't take more." "You mean you can't take less," said the Hatter. "It's very easy to take more than nothing." |
As we begin, you may find it helpful to turn on syntax highlighting!
- This feature colours your syntax to make it easier (and more fun!) to use Wikitext.
- To enable it, toggle the button (20px) that appears in the toolbar.
- If you're curious about how this works, see: Extension:CodeMirror.
Formatting
= Characters =
- Bold: Use three apostrophes(') on either side.
foo - Italics: Use two apostrophes(') on either side.
foo - Bold + Italics: Use five apostrophes(') on either side.
foo - {{strikethrough|Strikethrough}}: Use the template {{tl|strikethrough}}.
{{strikethrough|foo}} - {{underline|Underline}}: Use the template {{tl|underline}}.
{{underline|foo}} - {{smallcaps|small caps}}: Use the template {{tl|smallcaps}}.
{{smallcaps|foo}}
== Formatting a link ==
To format a link, add the apostrophes around the parentheses:
If you do it the other way around, it will not work since the parentheses interpret the apostrophes as part of the page name.
= Line breaks =
- If you press {{key top|Enter}} once, it will place a line break in the markup but not in the rendered result.
- If you press {{key top|Enter}} twice, it will insert a line break in the rendered result.
- Lists are an exception. These require one, not two, markup line breaks.
- To insert a line break without pressing {{key top|Enter}} twice, type
,
, or {{tl|pb}}. But, use sparingly.
= Make lists =
== Bullet lists ==
- a
- b
- c
produces:
- a
- b
- c
== Numbered lists ==
- a
- b
- c
produces:
- a
- b
- c
Link
= Internal pages =
- Use
to link to an articlefoo - Use a pipe (
) to insert a parameter which changes what the link says. For example:|
gives Wikipedia:AboutWikipedia:About
gives About page of WikipediaAbout page of Wikipedia
== Images ==
Link images in the same way that you would link any other internal page. For example,
gives:
Extended syntax for an image looks something like this:
{{pb}}
Here, only File is technically necessary. Most images only require:
{{pb}}
Here, thumb
stands in for the size
parameter.
=== Alt text ===
Please: always insert alt text! Alt text describes visual content for users of screen readers and other visual-to-auditory assistive technologies. Rule of thumb: write out alt text as if you're describing the image to someone in another room.
= Other language Wikipedias =
- Look up the two-letter language code per ISO 639-1.
- This is the same two-letter code at the beginning of the URL which takes you to that specific language Wikipedia.
- For example, en.wikipedia.org with the ISO 639-1 code en (English) takes you to the English Wikipedia.
- Use
two-letter language code:
article name to link directly to the other-language Wikipedia page: - For example,
gives :fa:زرتشت. This is the Farsi page for Zarathustra:fa:زرتشت - You can use what's called the "pipe trick" (add a pipe symbol(|) to the end of the article name) to have the output only display the article name
gives زرتشت- Or, as you did in previous sections, use a pipe (
) to insert a parameter which changes what the link says|
gives Zarathustra in FarsiZarathustra in Farsi
== Pages that exist in other languages but not in English ==
- Use the template {{tl|interlanguage link}} ({{tl|ill}} for short) if you wish to link to the other-language article until the English article becomes available.
gives {{interlanguage link|INRS-Institut Armand-Frappier|fr}}{{interlanguage link|INRS-Institut Armand-Frappier|fr}}
= Other Wikimedia projects =
- Add a prefix (shortcuts available) before the page name to link to other Wikimedia projects. For example:
gives :wikt:toothbrush:wikt:toothbrush
gives :simple:toothbrush:simple:toothbrush - Remember: you can always change what the links say by using a pipe(|)!
- Sometimes, the prefixes don't work without a colon(:) at the beginning. You may have to play around with it a bit.
- See Help:Interwiki linking#Prefix codes for linking to Wikimedia sister projects for a comprehensive chart.
== Wikidata and Reasonator ==
- Use the template {{tl|Wikidata entity link}} ({{tl|q}} or {{tl|wde}} for short) to link to an existing Wikidata item.
gives {{q|Q20155952}}{{q|Q20155952}}
gives {{q|P197}}{{q|P197}} - You can also use {{tl|ill}} to display links to Wikidata and Reasonator! We will try with the item for {{q|20155952}}, since this does not currently have a Wikipedia page.
gives {{ill|Reasonator|qid=Q20155952}}{{ill|Reasonator|qid=Q20155952}}
gives {{ill|Reasonator|qid=Q20155952|reasonator=1}}{{ill|Reasonator|qid=Q20155952|reasonator=1}}
gives {{ill|Reasonator|reasonator=1}}{{ill|Reasonator|reasonator=1}} - If no
is given, Reasonator will perform a search for the item. Note that this can be imprecise, and often requires disambiguation.|qid=
= External links =
- Use
to add an external, non-Wikimedia link[foo] - Technically, any link (even internal links) can be made this way, but the internal link rules (using
) make those look much cleanerfoo - Use a space (
) to label the link. For example:
just gives [https://insulin.library.utoronto.ca/][https://insulin.library.utoronto.ca/]
gives [https://insulin.library.utoronto.ca/ Insulin Collection at the University of Toronto Libraries][https://insulin.library.utoronto.ca/ Insulin Collection at the University of Toronto Libraries]
Communication
= Sign =
- Signing is an etiquette on anonymous platforms! Use tildes(
) to sign off on comments, add yourself to Wikiprojects, etc.~
: Three tildes(~) produce your signature Utl jung (talk)~~~
: Four tildes(~) produce your signature + timestamp Utl jung (talk) 17:13, 7 August 2020 (UTC)~~~~ - Use this one on talk pages
: Five tildes(~) produce a timestamp 17:13, 7 August 2020 (UTC)~~~~~
= Ping =
- You can notify ("ping") a user by making an edit that links to their user page.
- Typing
@Username
will not automatically ping the user. - There are many ways to do this. To use myself (User:Utl_jung) as an example, you can write:
gives {{u|Utl_jung}} and notifies the user (this option does not append an "@"){{u|Utl_jung}}
gives {{ping|Utl_jung}} and notifies the user{{ping|Utl_jung}}
gives {{ping|Utl_jung}} and notifies the user{{re|Utl_jung}}
= Indent =
On talk pages, add a colon(:) to indent every time you reply within a thread. For example:
Hello world! ~~~~
:I see your comment. ~~~~
::{{re|Utl_jung}} I, too, see your comment. ~~~~
produces:
----
Hello world! Utl jung (talk) 17:13, 7 August 2020 (UTC)
:I see your comment. Utl jung (talk) 17:13, 7 August 2020 (UTC)
::{{re|Utl_jung}} I, too, see your comment. Utl jung (talk) 17:13, 7 August 2020 (UTC)
----
= Outdent =
Once there are too many indents, it can help to {{tl|outdent}} ({{tl|out}} for short) for better readability. For example:
[...]
:::::The latest in a long thread of comments. ~~~~
{{out|:::::}}{{re|Utl_jung}} Let's reset the indents for readability. ~~~~
produces:
----
[...]
:::::The latest in a long thread of comments. Utl jung (talk) 17:13, 7 August 2020 (UTC)
{{out|:::::}}{{re|Utl_jung}} Let's reset the indents for readability. Utl jung (talk) 17:13, 7 August 2020 (UTC)
----
Documentation
When writing documentation, it can help to know a few templates and HTML snippets which make it easier to distinguish input from output.
- Use {{tag|nowiki}} to escape all contained Wiki markup
- Use {{tag|code}} to stylise contained text as code
- Use
{{tl|tl}}
to write about a template without triggering the template itself - To use, write:
+{{tl |
+ template name +}} - For example,
displays the link to, but does not trigger, {{tl|archival records}}{{tl|archival records}}
= Transclusion =
{{Wikipedia:Transclusion/How Transclusion Works}}
Journey ahead
Once comfortable with the basics of Wiki markup, I highly recommend that you reference these wonderful existing documentation pages to do more and more things with Wiki markup!
= Nifty customisation! =
- Syntax highlighter tool - allows custom coloured highlighting for Wiki markup syntax.
- Enable under Preferences (user toolbar in the top right) > Gadgets