Help:Wikicode

From Bulbapedia, the community-driven Pokémon encyclopedia.
Revision as of 01:23, 14 February 2023 by Rustle (talk | contribs) (→‎Wikilinks)
Jump to navigationJump to search
Shortcut
H:CODE

This article will explain the basics of wikicode (also known as wikitext or wiki markup), giving examples of the various techniques used to make the many pages on Bulbapedia. While this may be helpful, however, the best way to learn is to look at the coding on a page to see how it is done and modify it to see how it changes. Just make sure to use the preview button!

Layout

Sections

Sections break an article down into more manageable chunks and are created using = to ======.

Markup Result
==Level 2==
===Level 3===
====Level 4====
=====Level 5=====
======Level 6======
Level 2
Level 3
Level 4
Level 5
Level 6
  • 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 = – this will either break the heading, or will cause the heading to not be included in an edit summary.

HTML

Headings can also be created by using HTML elements.

Markup Result
<h2>Level 2</h2>
<h3>Level 3</h3>
<h4>Level 4</h4>
<h5>Level 5</h5>
<h6>Level 6</h6>
Level 2
Level 3
Level 4
Level 5
Level 6

These should not normally be used on articles, and are instead used within templates, as they do not include [edit] links.

Horizontal rule

The horizontal rule represents a paragraph-level thematic break. Do not use in article content, as rules are used only after main sections, and this is automatic.

Markup Result
----

<hr />

Horizontal rules are achieved with wikicode or HTML. However, ---- must always be at the start of a line, whereas <hr /> can be used anywhere.

Table of contents

Shortcut
H:TOC

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:

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

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 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 list markup.
  • Markup such as bold or italics will be terminated at a line break.
Markup Result
A single newline here
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 here has no effect on the layout.

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

Line breaks can also be created with <br /> and {{-}}.

Markup Result
Here is some text about Pokémon.<br /> Here is some more text about Pokémon.
Here is some text about Pokémon.
Here is some more text about Pokémon.
Here is some text about Pokémon.{{-}} Here is some more text about Pokémon.
Here is some text about Pokémon.
Here is some more text about Pokémon.

{{-}} adds a break with styling, to clear floating elements. This is often used to prevent text from flowing next to unrelated tables, images or templates.

Indented text

Indented text is most commonly used on talk pages to help keep track of replies.

Markup Result
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

Blockquotes are useful when there is a need to separate a block of text, such as (as the name suggests) inserting a large quote into an article.

Markup Result
Text before
<blockquote>
<p>Quoted paragraph</p>
<p>Name, Source, Reference</p>
</blockquote>
Text after
Text before

Quoted paragraph

Name, Source, Reference

Text after

Lists

Shortcut
H:LIST

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 Result
* Item 1
* Item 2
* Item 3
* Item 4
** Sub-item 1
*** Sub-sub-item
**** Sub-sub-sub-item
** Sub-item 2
* Item 5
  • Item 1
  • Item 2
  • Item 3
  • Item 4
    • Sub-item 1
      • Sub-sub-item
        • Sub-sub-sub-item
    • Sub-item 2
  • Item 5

Ordered lists

Markup Result
# Item 1
# Item 2
# Item 3
# Item 4
## Sub-item 1
### Sub-sub-item
#### Sub-sub-sub-item
## Sub-item 2
# Item 5
  1. Item 1
  2. Item 2
  3. Item 3
  4. Item 4
    1. Sub-item 1
      1. Sub-sub-item
        1. Sub-sub-sub-item
    2. Sub-item 2
  5. Item 5

It is also possible to set a starting value of an ordered list:

Markup Result
# <li value="7">Item 1</li>
# Item 2
# Item 3
# Item 4
  1. Item 1
  2. Item 2
  3. Item 3
  4. Item 4

Mixed lists

Markup Result
# Item 1
# Item 2
#* Sub-item 1
#* Sub-item 2
#*# Sub-sub-item 1
#*# Sub-sub-item 2
#* Sub-item 3
#** Sub-sub-item
# Item 3
  1. Item 1
  2. Item 2
    • Sub-item 1
    • Sub-item 2
      1. Sub-sub-item 1
      2. Sub-sub-item 2
    • Sub-item 3
      • Sub-sub-item
  3. Item 3

Description 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. The format can also be used for other purposes, such as make and models of vehicles, etc.

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

Markup Result
; Term : Definition 1
Term
Definition 1
; Term
: Definition 1
: Definition 2
: Definition 3
: Definition 4
Term
Definition 1
Definition 2
Definition 3
Definition 4

Retaining newlines

The MediaWiki software suppresses single newlines and converts lines starting with a space to preformatted text in a dashed box. It is often desirable to retain these elements for poems and lyrics. <ab>...</ab> tags maintain newlines.

Markup Result
<ab>''I wanna be the very best
Like no one   ever was
To catch them is my real test
To train them is my cause

I will travel across the land
Searching far and wide
Teach Pokémon to understand
The power that's inside''</ab>

I wanna be the very best
Like no one ever was
To catch them is my real test
To train them is my cause

I will travel across the land
Searching far and wide
Teach Pokémon to understand
The power that's inside

Text formatting

Shortcut
H:TEXT
Description Markup Result
Italics, bold, and both
''italics'', '''bold''', and '''''both'''''
italics, bold, and both
Strikethrough text
Use <s>on articles</s> only on talk pages
Use on articles only on talk pages
Subscript and superscript
Make text <sub>subscript</sub> or <sup>superscript</sup> easily
Make text subscript or superscript easily
Small text
Use <small>small text</small> only when necessary
Use small text only when necessary
Big text
Avoid using <big>big text</big> where possible
Avoid using big text where possible
Small caps
Render text in <sc>Small caps</sc> with ease
Render text in Small caps with ease
Ruby characters
{{ruby|株式会社|かぶしきがいしゃ}}ジュピター
株式会社(かぶしきがいしゃ)ジュピター
Color text
<span style="color:#FF00FF">Magenta text</span>
Magenta text
Highlight text
<mark>Highlighted text</mark>
<mark style="background:lightblue;">Highlighted text</mark>
Highlighted text

Highlighted text

Show code in text
Use a <code>:</code> to indent text
Use a <code><nowiki><br /></nowiki></code> to create a new line
Use a : to indent text

Use a <br /> to create a new line

Links

Shortcut
H:LINK

Wikilinks

Wikilinks are used in wikicode markup to produce internal links between pages. You create wikilinks by putting double square brackets [[ ]] around text designating the title of the page you want to link to.

Markup Result
[[Pokémon Trainer]]
Pokémon Trainer

A red link is a page that doesn't exist yet; it can be created by clicking on the link.

Markup Result
[[Ash's Mudkip]]
Ash's Mudkip

A self link (a link to the page on which the link appears) will appear only as bold text.

Markup Result
[[Help:Wikicode]]
Help:Wikicode

Renamed links

Links can be renamed by adding a | after the target page's name and before the final ]]. A replacement name can then be typed between them.

Markup Result
[[Pokémon Trainer|Trainer]]
Trainer
Automatically renamed links

In certain circumstances, it is possible to have a link be automatically renamed by typing the | character before the final ]] and saving the page. The links will be automatically extended according to the following rules:

Description Markup Result
Automatically hide text in parentheses
[[Bulbasaur (Pokémon)|]]
Bulbasaur
Automatically hide namespace
[[Bulbapedia:Editor's Hub|]]
Editor's Hub
Or both
[[Talk:Pikachu (Pokémon)|]]
Pikachu
Text after commas are hidden too
[[Get Fired Up, Spiky-eared Pichu!|]]
Get Fired Up
But this doesn't work for section links
[[Bulbapedia:Manual of Style#Links|]]
[[Bulbapedia:Manual of Style#Links|]]

When previewing your edits, you will not see the expanded form until you press Save and Edit again. For this reason, and because of the limitations outlined above, it is almost always preferable to use a link template instead.

Blended links

Endings are automatically blended into the link, which can be useful when discussing plurals, rather than having to rename the link itself.

Markup Result
[[Pokémon Trainer]]s
Pokémon Trainers
[[Move]]ment
Movement

This behaviour can be suppressed by adding <nowiki /> directly after the link.

Linking to page sections

It is also possible to link directly to page sections by including their title the link, separated by a #. These links can also be renamed.

Markup Result
[[Pokémon Trading Card Game#Japanese sets]]
Pokémon Trading Card Game#Japanese sets
[[Pokémon Trading Card Game#Japanese sets|Japanese sets]]
Japanese sets

It is also possible to link directly to other points on a page, by including the {{anchor}} template at the point you want to link to.

Interlanguage links

Shortcut
H:INTERLANG

Bulbagarden is a member of Encyclopædiæ Pokémonis, a group of seven Pokémon wikis in different languages.

Wiki Language Code Template
PokéWiki German de {{de}}
WikiDex Spanish es {{es}}
Poképédia French fr {{fr}}
Pokémon Central Wiki Italian it {{it}}
Pokémon Wiki Japanese ja {{ja}}
52Poké Wiki Chinese zh {{zh}}

Pokéteca, LANDpedia and Wikinezka are former members of Encyclopædiæ Pokémonis, and their interlanguage links have been removed.

Links in the sidebar

Links to the same article at another Encyclopædiæ Pokémonis wiki can be added to the sidebar, by including an interlanguage link at the bottom of an article, below categories. It is also possible to link to a section of an article where more appropriate.

Markup Result
[[de:Hilfe:Bearbeitungshilfe]]
[[es:Ayuda:Guía de edición]]
[[it:Aiuto:Manuale di stile#Principi base del codice wiki (wikicode)]]
[[ja:ポケモンWiki:編集例]]
[[zh:Help:编辑页面]]
Links will appear in the sidebar.
Inline links

It is also possible to add links to these wikis within the text of an article. To do this, begin the link with a :. However, while this is allowed, it is preferred that a link template is used wherever possible.

Markup Result
[[:ja:ピカチュウ]]
ja:ピカチュウ
{{ja|ピカチュウ}}
ピカチュウ
{{ja|ピカチュウ|Pikachu on Pokémon Wiki}}
Pikachu on Pokémon Wiki

Be aware that invalid interlanguage links will not appear as redlinks. Therefore, it is important to preview your edits before saving.

Interwiki links

Shortcut
H:INTERWIKI

Interwiki links are used to link to a page on a different wiki. Invalid interwiki links will not appear as redlinks and so it is important to preview your edits before saving. For a full list of interwiki codes, see Special:Interwiki.

Bulbagarden

It is possible to link to pages or files on Bulbagarden Archives and articles on the retired Bulbanews wiki using interwiki links or associated link templates.

Wiki Code Template
Bulbagarden Archives a {{file}}
Bulbanews n {{n}}

Unlike inline interlanguage links, there is no need to proceed the link with a :. Where possible, use a link template, rather than a plain link.

Markup Result
{{file|Bulbapedia logo.png}}
Bulbapedia logo.png
[[a:Category:Pikachu|Images of Pikachu]]
Images of Pikachu
{{n|Farfetch'd evolution Sirfetch'd revealed}}
Farfetch'd evolution Sirfetch'd revealed
NIWA

Bulbapedia is a member of the Nintendo Independent Wiki Alliance, a group of 25 wikis each dedicated to a different Nintendo franchise or game.

NIWA wikis
Wiki Code Template
Zelda Wiki zw {{zw}}
Super Mario Wiki smw {{smw}}
Ukikipedia uki {{uki}}
Metroid Wiki met {{met}}
WiKirby wk {{wk}}
Wars Wiki ww {{ww}}
Lylat Wiki lw {{lw}}
Pikipedia pk {{pk}}
Pikmin Fanon pkf {{pkf}}
StrategyWiki strategy {{sw}}
SmashWiki sbw {{sbw}}
WikiBound wb {{wb}}
Nookipedia np {{np}}
Golden Sun Universe gsu {{gsu}}
NintendoWiki nw {{nw}}
Fire Emblem Wiki few {{few}}
Starfy Wiki lsw {{lsw}}
F-Zero Wiki fzw {{fzw}}
Icaruspedia ip {{ip}}
Dragon Quest Wiki dqw {{dqw}}
Hard Drop Tetris Wiki hdt {{hdt}}
Inkipedia ink {{ink}}
ARMS Institute ai {{ai}}
Xeno Series Wiki xsw {{xsw}}
Dragalia Lost Wiki dlw {{dlw}}

It is possible to link to these wikis using interwiki links or their associated link template.

Markup Result
[[strategy:Super Smash Bros. Ultimate]]
strategy:Super Smash Bros. Ultimate
{{sw|Super Smash Bros. Ultimate}}
Super Smash Bros. Ultimate
Wikimedia

The Wikimedia Foundation offers a series of free wikis, the most famous being Wikipedia.

Wikimedia wikis
Wiki Code Template
Wikipedia (English) wp {{wp}}
Wikipedia (German) dewp {{dewp}}
Wikipedia (Japanese) jwp {{jwp}}
Wiktionary Wiktionary -
Wikibooks WikiBooks -
MediaWiki mw -

It is possible to link to these wikis using interwiki links or (where available) their associated link template.

Markup Result
[[wp:Pokémon]]
wp:Pokémon
{{wp|Pokémon}}
Pokémon

Other link templates

Main article: Bulbapedia:List of link templates

A link template is a type of template that produces a standardised format of link. Because the wiki has thousands of pages, these standardised links are helpful because they create consistency across the wiki and mean that changes need only be made to one page, rather than hundreds. Because of this, it is an official guideline that link templates should be used whenever possible.

Redirects

Shortcut
H:REDIRECT

A redirect is a page created so that navigating to a given title takes the reader directly to a different page. It is also possible to redirect to a particular section on a page. Redirects are usually created because readers may search for an article under different names, but it is not necessary to create redirects from every title an editor may conceivably wish to link to a given page.

Markup Result
#REDIRECT [[Bulbasaur (Pokémon)]]
Redirect.png Bulbasaur (Pokémon)
#REDIRECT [[Bulbasaur (Pokémon)#Game data]]
Redirect.png Bulbasaur (Pokémon)#Game data

Redirects will only work if the very first thing on the page is #REDIRECT, followed by a valid wikilink.

Categories

See also: Help:Categories

Categories, a software feature of MediaWiki, provide automatic indexes that are useful as tables of contents. You can categorize pages and files by adding one or more Category tags to the wikicode. These tags create links at the bottom of the page that take you to the list of all pages in that category, which makes it easy to browse related articles.

Markup Result
[[Category:Help]]
Links will appear in a bar at the bottom of the page.

Categories are usually added at the bottom of the wikicode. However, some templates will add pages to categories when used.

It is also possible to link to a category page within the text of an article. To do this, begin the link with a :.

Markup Result
[[:Category:Help]]
Category:Help
[[:Category:Help|More help pages]]
More help pages

External links

Shortcut
H:EXT

It is possible to link to external websites within wikicode. However, external links normally should not be placed in the body of an article, and instead should be placed within a dedicated section, within an infobox template, or as part of a reference. Acceptable external links are websites containing further relevant information to the topic at hand, and no page should be linked to unless it meets this criterion. You must never link to illegally obtained material such as ROMs and hacks.

It is possible to link to external websites in three ways:

Markup Result
https://www.pokemon.com/
https://www.pokemon.com/
[https://www.pokemon.com/]
[1]
[https://www.pokemon.com/ Pokémon website]
Pokémon website

The third option is usually the preferred choice, but the text used must be descriptive, and never misleading.

It is also possible to link to external images:

Markup Result
http://www.bulbagarden.net/gateway/banner-pikachu.png
banner-pikachu.png

However, this is not normally allowed on content namespaces. Instead, images should be uploaded to Bulbagarden Archives.

Images

Main article: Help:Images

Tables

Main article: Help:Tables

Referencing

See also: Bulbapedia:Referencing

Inline citations allow users of Bulbapedia see the sources used to create the articles they read on the wiki.

References are added directly after a fact they support, or at the end of the sentence they support. The reference includes the web page the information comes from, and the date the information was found.

Markup Result
Hello World!<ref>[https://www.nintendo.com/whatsnew/ ''News'' - Nintendo.com] (retrieved October 15, 2022)</ref>
Hello World![1]

References can be named, so that they can be used again within the same article.

Markup Result
Hello World!<ref name="Poké">[https://www.pokemon.com/us/pokemon-news/ ''Pokémon News'' - Pokémon.com] (retrieved October 15, 2022)</ref>

Hello again!<ref name="Poké" />
Hello World![2]

Hello again![2]

References are displayed at the bottom of the article, in their own dedicated section.

Markup Result
==References==
{{reflist}}
References
  1. News - Nintendo.com (retrieved October 15, 2022)
  2. 2.0 2.1 Pokémon News - Pokémon.com (retrieved October 15, 2022)

Templates

Main article: Help:Templates

Magic words

Shortcut
H:MAGIC
For a full list, see mw:Help:Magic words

Magic words (including parser functions, variables and behavior switches) are features of wikicode that give instructions to Bulbapedia's underlying MediaWiki software and are especially useful for templates.

  • Behavior switches (e.g. __NOTOC__) will change the behavior of a page, rather than return a value.
  • Parser functions (e.g. {{#ifexpr:Y|Yes|No}}) will take a value and return a value.
  • Variables (e.g. {{PAGENAME}}) will return a value in their place.

Behaviour switches

Word Description
__NOTOC__
Hides the table of contents.
__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.
__NOEDITSECTION__
Hides the section edit links beside headings.
__NEWSECTIONLINK__
Adds a link beside the "Edit" tab for adding a new section on a non-talk page.
__NONEWSECTIONLINK__
Removes the link beside the "Edit" tab on pages in talk namespaces.
__HIDDENCAT__
Used on a category page, hides the category from the lists of categories in its members and parent categories.
__EXPECTUNUSEDCATEGORY__
Used on a category page, removes the category from Special:UnusedCategories.
__DISAMBIG__
Identifies a disambiguation page.

Parser functions

Parser functions can have an impact on system resources, and thus should be used sparingly, and only when strictly necessary. Typically, parser functions are only used in templates. See mw:Help:Extension:ParserFunctions for a list of available parser functions, and Help:Templates for how they can be used on Bulbapedia.

Variables

Date & time

The following variables return the current date and time in UTC. Due to MediaWiki and browser caching, these variables frequently show when the page was cached rather than the current time.

Word Output Description
{{CURRENTYEAR}}
2024 Year.
{{CURRENTMONTH}}
11 Month (zero-padded number).
{{CURRENTMONTH1}}
11 Month (unpadded number).
{{CURRENTMONTHNAME}}
November Month (name).
{{CURRENTMONTHABBREV}}
Nov Month (abbreviation).
{{CURRENTDAY}}
22 Day of the month (unpadded number).
{{CURRENTDAY2}}
22 Day of the month (zero-padded number).
{{CURRENTDAYNAME}}
Friday Day of the week (name).
{{CURRENTTIME}}
15:04 Time (24-hour HH:mm format).

Technical metadata

Word Output Description
{{SITENAME}}
Bulbapedia The wiki's site name.
{{SERVERNAME}}
bulbapedia.bulbagarden.net Subdomain and domain name.
{{REVISIONDAY}}
14 Day latest revision to current page was made (unpadded number).
{{REVISIONDAY2}}
14 Day latest revision to current page was made (zero-padded number).
{{REVISIONMONTH}}
02 Month latest revision to current page was made (zero-padded number).
{{REVISIONMONTH1}}
2 Month latest revision to current page was made (unpadded number).
{{REVISIONYEAR}}
2023 Year latest revision to current page was made.
{{REVISIONUSER}}
Rustle The username of the user who made the most recent edit to the page (or the current user when previewing an edit).

Statistics

Numbers returned by these variables normally contain commas but can return raw numbers with the ":R" flag (for example, {{NUMBEROFPAGES}} → 276,961 and {{NUMBEROFPAGES:R}} → 276961).

Word Output Description
{{NUMBEROFPAGES}}
276,961 Number of wiki pages.
{{NUMBEROFARTICLES}}
53,852 Number of pages in content namespaces that qualify as articles.
{{NUMBEROFEDITS}}
4,126,601 Number of wiki edits.
{{NUMBEROFFILES}}
0 Number of uploaded files (only useful on Bulbagarden Archives).
{{NUMBEROFUSERS}}
366,008 Number of registered users.
{{NUMBEROFADMINS}}
33 Number of users in the sysop group.
{{NUMBEROFACTIVEUSERS}}
517 Number of active users, based on the criteria used in Special:Statistics.

Page modifiers

Word Description
{{DISPLAYTITLE:title}} Format the current page's title header.
The value must be equivalent to the default title: only capitalization changes to certain parts of the title (not all), adding italics, and replacing spaces with underscores are allowed.
{{DEFAULTSORT:sortkey}} Used for categorizing pages, sets a default category sort key.
For example, if you put {{DEFAULTSORT:Underground, The}} at the end of The Underground, the page would be sorted under "U" by default in categories.

Page names

Word Output Description
{{FULLPAGENAME}}
Help:Wikicode Namespace and full page title (including all subpage levels).
{{PAGENAME}}
Wikicode Full page title (including all subpage levels) without the namespace.
{{BASEPAGENAME}}
Wikicode Page title of the page in the immediately superior subpage level without the namespace.
For example, it would return Title/Foo on page Help:Title/Foo/Bar.
{{ROOTPAGENAME}}
Wikicode Name of the root of the current page. Would return Title on page Help:Title/Foo/Bar.
{{SUBPAGENAME}}
Wikicode The subpage title. Would return Bar on page Help:Title/Foo/Bar.
If no subpage exists the value of {{PAGENAME}} is returned.
{{SUBJECTPAGENAME}}
Help:Wikicode Full page name of the associated subject (e.g. article or file). Useful on talk pages.
{{TALKPAGENAME}}
Help talk:Wikicode Full page name of the associated talk page.

Namespaces

Word Output Description
{{NAMESPACE}}
Help Name of the page's namespace (except for main space).
{{NAMESPACENUMBER}}
12 ID of the page's namespace.
{{SUBJECTSPACE}}
Help Name of the associated content namespace. Useful on talk pages.
{{TALKSPACE}}
Help talk Name of the associated talk namespace.

See also