Content deleted Content added
Remove section: Chess symbols b/c not specific to Wikitext, rarely used on Wikipedia, and arbitrarily selected among many Unicode character blocks |
anchors should be at the start of the relevant content, not dropped randomly nearby; upright has never been described in this page, afaict, so link to somewhere that it's properly described |
||
(31 intermediate revisions by 20 users not shown) | |||
Line 6:
{{Locutions pages header}}
{{Wikipedia how to|H:WT|H:MARKUP|H:WIKICODE}}
{{VE documentation}}
{{Wikitext navbox}}
To learn how to view and edit wikitext, and how to save changes, see [[Help:Editing]]. In most cases, markup can be copied and pasted without the need to write new code. A quick reference guide is available at [[Help:Cheatsheet]].
In addition to wikitext, some [[HTML element]]s are also allowed for presentation formatting. See [[Help:HTML in wikitext]] for information on this.▼
▲In addition to wikitext, some [[HTML
{{TOC limit}}
Line 42 ⟶ 45:
}}
The four hyphens must appear at the beginning of a line.
HTML equivalent: {{tag|hr|s}} (which can be indented, whereas <code>----</code> always starts at the left margin.)▼
▲The HTML equivalent
The template {{tl|Hr}} produces a similar rule but allows the thickness to be specified.
====Table of contents====
Line 60 ⟶ 67:
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|Enter}} twice.
* Pressing {{key press|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.
* Blank lines within indented wikitext should not be added due to accessibility issues.
{{markup
Line 225 ⟶ 230:
}}
====<span class="anchor" id="DL"></span><span class="anchor" id="Definition lists"></span><span class="anchor" id="Association lists"></span><span class="anchor" id="H:DL"></span>Description lists====
{{Shortcut|H:DL}}
Line 426 ⟶ 430:
To prevent two words from becoming separated by a [[linewrap]] (e.g. ''Mr. Smith'' or ''400 km/h'') a '''[[non-breaking space]]''', sometimes also called a "non-printing character", may be used between them. (For three or more words, the template {{tl|nowrap}} is probably more suitable.)
|
<syntaxhighlight lang="html">Mr.&
|
Mr. Smith or 400 km/h
Line 896 ⟶ 900:
|}
* To create a new page:
*# Enter a [[help:Redlink|redlink]] wikilink: <nowiki>[</nowiki>[page name]].
▲*# Save that page.
*# Preview or save.
*#
* For more information, see [[Wikipedia:Starting an article|starting an article]] and check out Wikipedia's [[Wikipedia:Naming conventions|naming conventions]].
* Please
{| class="wikitable"
Line 918 ⟶ 923:
|}
===Create an alias for a page===
{{main|Help:Redirect}}
* Create an alias for any page by creating a [[Wikipedia:Redirect|Redirect]] from one [[Help:Page name| page name]] to another.
* First create a new page whose page name is the name of the alias. That is the redirect.
* It is possible to redirect to a section. For example, a redirect to [[United States#History]] will redirect to the History section of the [[United States]] page, if it exists.▼
* On the ''first'' line of the new redirect page, use the syntax shown in the table below. For example, [[US]] is a redirect.
▲* It is possible to redirect to a section. For example, a redirect to [[United States#History]] will redirect to the History section of the [[United States]] page
{| class="wikitable" border=1
Line 1,114 ⟶ 1,121:
''Unnamed link''
This should [[WP:CS:EMBED|not be used in articles]] except in [[Wikipedia:External links#Links in lists|certain lists]].
|
<syntaxhighlight lang="wikitext" inline>[https://www.wikipedia.org]</syntaxhighlight>
Line 1,239 ⟶ 1,246:
* Embedding the image in the text is only possible for very small images.
* Embedding the image will affect the vertical formatting of text.
|- style="vertical-align: top;" id="alt tag"
| <syntaxhighlight lang="wikitext">With alternative text:
[[File:wiki.png|alt=Puzzle globe logo]]</syntaxhighlight>
Line 1,247 ⟶ 1,254:
|
*
|- style="vertical-align:top;"
Line 1,269 ⟶ 1,276:
* The frame tag automatically floats the image right.
* The frame tag is only of use with very small images or ones using the [[#px tag|px tag]]
* The attributes left, center or centre override this, and places the image to the left or the centre of the page.
* The last parameter is the caption that appears below the image.
Line 1,296 ⟶ 1,303:
* The [[WP:PIC|picture tutorial]] explains more options.
|- style="vertical-align:top;" id="px tag"
| <syntaxhighlight lang="wikitext">A picture resized to 50 pixels...
[[File:wiki.png|50 px|Wikipedia encyclopedia]]</syntaxhighlight>
Line 1,304 ⟶ 1,311:
|
*
* Sizing in pixels is deprecated and should be used very sparingly.
* There is an [[
|- style="vertical-align:top;"
Line 1,452 ⟶ 1,459:
If a page is transcluded without transclusion markup, it may cause an unintentional [[Help:Category#Putting_pages_in_categories|categorization]]. Any page transcluding it will contain the same category as the original page. Wrap the category markup with '''<nowiki><noinclude></nowiki>''' tags to prevent incorrect categorization.
Some templates take ''parameters'', as well, which you separate with the pipe character <code>|</code>.
Line 1,468 ⟶ 1,475:
|
{{Help:Transclusion demo}}
|- id=hovertext
|-▼
|
<syntaxhighlight lang="wikitext">
Line 1,622 ⟶ 1,629:
===Coloring and highlighting text===
<!-- requiring edit, color properties not appearing correctly and the text is still white -->
*Using the {{tl|Color}} and {{tl|Font color}} templates:
{| class="wikitable"
Line 1,645 ⟶ 1,652:
This is how to {{Font color||yellow|highlight part of a sentence}}.
|}
===Example text===
Line 1,685 ⟶ 1,690:
|-
|
<syntaxhighlight lang="wikitext" inline>You can indicate <del>
|
You can indicate <del>
|}
===<span class="anchor" id="Strikethrough"></span> Strikethrough ===
{{see also|Help:HTML in wikitext#s}}
The {{tl|Strikethrough}} template marks up
The {{tl|Strikethrough}} template and {{tag|s}} tag are for inline content only; to strike out a block of text, such as a multi-line talk page post, use either {{tl|Strikethroughdiv}} or <syntaxhighlight lang=wikitext inline><div style="text-decoration: line-through"></div></syntaxhighlight> to render the entire block with strikethrough markup.
{| class=wikitable
!What you type
Line 1,699 ⟶ 1,706:
|<kbd><nowiki>This is {{</nowiki>'''Strikethrough'''<nowiki>|an obsolete stretch of text}} for comparison</nowiki></kbd>
|This is {{Strikethrough|an obsolete stretch of text}} for comparison
▲|-
|<kbd><nowiki>This is {{</nowiki>'''Strikethroughdiv'''<nowiki>|{{ubl|an obsolete bulleted list|with two items}}}} for comparison</nowiki></kbd>
|This is {{Strikethroughdiv|{{ubl|an obsolete bulleted list|with two items}}}} for comparison
|}
==
{{see also|Template:Escape template list}}
Several formatting methods in wikitext can force the wikitext to be displayed exactly as typed – essentially a "[[WYSIWYG|what you see is what you get]]" effect. These techniques are useful when you need to prevent wikitext from being interpreted by [[parser]], such as when showing examples of wikitext nested in a template.
{| class="wikitable" style="margin-right:0em;"
Line 1,801 ⟶ 1,812:
|}
===<span class="anchor" id="NOWIKI"></span>Nowiki===
{{redirect|WP:NOWIKI|the essay about the name "Wiki"|Wikipedia:Don't abbreviate "Wikipedia" as "Wiki"!|the Wikipedia language edition|Norwegian Wikipedia}}▼
▲{{redirect|WP:NOWIKI|the essay about the name "Wiki"|Wikipedia:Don't abbreviate "Wikipedia" as "Wiki"!}}
{{shortcut|H:NOWIKI|WP:NOWIKI}}
There are two types of nowiki markup, which operate in different ways:
:{{tag|nowiki}} (wiki markup contained between these two tags is displayed as normal text)▼
▲
* The empty {{tag|nowiki|s}} tag ''interrupts'' the wiki markup and causes it to display as normal text.
Note to template editors: tag {{tag|nowiki|o}} works only on its source page, not the target.
Line 1,840 ⟶ 1,852:
The rest of the section consists of simple, live examples showing how a single nowiki tag escapes entire linkage structures, beyond {{code|2=wikitext|[[wikilink]]}} and {{tlc|template}}:
:[[
:{{ ''pagename'' <nowiki />| ''parameter'' }}
:[[ ''fullpagename'' | {{ ''pagename'' }<nowiki />} ]<nowiki />]
Line 1,902 ⟶ 1,914:
{{markup|
<syntaxhighlight lang="wikitext">
{<nowiki />{ val | u=&
{{<nowiki /> val | u=&
{{ val <nowiki />| u=&
{{ val | u= > [[ms]] | 49082 }<nowiki />}
{{ val | u= > [[ ms ]<nowiki />] | 49082 }} </syntaxhighlight>
Line 1,913 ⟶ 1,925:
:{{<nowiki /> val | u=> [[ms]] | 49082 }}
:{{ val <nowiki />| u=> [[ms]] | 49082 }}
:{{ val | u=
</poem>
}}
====Displaying magic words====
{{Further|Help:Magic words|Help:Parser function}}
Line 2,039 ⟶ 2,052:
}}
{{anchor|Invisible pre}}Invisible HTML {{tag|pre|o}} tags can also be inserted by preceding text with a space character, like:
<!--Comment-->
Line 2,066 ⟶ 2,079:
|-
| <nowiki>{{CURRENTWEEK}}</nowiki> || {{CURRENTWEEK}}
|Number of weeks since January 1 (January 1 can be in week 1; but only if it's a Monday, Tues, Wed, Thurs - if it's Friday, Sat or Sun, Jan 1 will be in week 52 or 53){{cn|date=August 2025|}}
|-
| <nowiki>{{CURRENTDOW}}</nowiki> || {{CURRENTDOW}}
|
|-
Line 2,078 ⟶ 2,091:
| <nowiki>{{CURRENTMONTHNAME}}</nowiki>
| {{CURRENTMONTHNAME}}
|The nominative (subject) form, as usually seen in English
|-
| <nowiki>{{CURRENTMONTHNAMEGEN}}</nowiki>
| {{CURRENTMONTHNAMEGEN}}
|-
| <nowiki>{{CURRENTDAY}}</nowiki> || {{CURRENTDAY}}
Line 2,098 ⟶ 2,111:
| <nowiki>{{NUMBEROFARTICLES}}</nowiki>
| {{NUMBEROFARTICLES}}
|-
| <nowiki>{{NUMBEROFPAGES}}</nowiki>
Line 2,147 ⟶ 2,160:
|
|}
In languages where it makes a difference, you can use constructs like <syntaxhighlight lang="wikitext" inline>{{grammar:case|word}}</syntaxhighlight> to convert a word from the nominative case to some other case. For example, <syntaxhighlight lang="wikitext" inline>{{grammar:genitive|{{CURRENTMONTHNAME}}}}</syntaxhighlight> means the same as <syntaxhighlight lang="wikitext" inline>{{CURRENTMONTHNAMEGEN}}</syntaxhighlight>
▲'''{{tlf|NUMBEROFARTICLES}}''' is the number of pages in the main namespace that contain a link and are not a redirect. This includes full articles, stubs containing a link, and disambiguation pages.
▲'''{{tlf|CURRENTMONTHNAMEGEN}}''' is the genitive (possessive) grammatical form of the month name, as used in some languages but not in English; '''{{tlf|CURRENTMONTHNAME}}''' is the nominative (subject) form, as usually seen in English.
▲In languages where it makes a difference, you can use constructs like <syntaxhighlight lang="wikitext" inline>{{grammar:case|word}}</syntaxhighlight> to convert a word from the nominative case to some other case. For example, <syntaxhighlight lang="wikitext" inline>{{grammar:genitive|{{CURRENTMONTHNAME}}}}</syntaxhighlight> means the same as <syntaxhighlight lang="wikitext" inline>{{CURRENTMONTHNAMEGEN}}</syntaxhighlight>. <!-- Is there a reference for this, other than the source code (for example, phase3/languages/Lnaguage*.php) ? -->
==HTML==
Line 2,177 ⟶ 2,185:
*[[mw:Parsoid|Parsoid]]: MediaWiki application that allows for converting back and forth between wikitext and HTML.
*{{tl|Syntaxhighlight}}: template to show wrapped syntax-highlighted text.
*[[Help:Displaying a formula]]: [[Help:Displaying a formula#LaTeX basics|LaTeX]] and [[Help:Displaying a formula#Chemistry|Chemistry notation]]
{{Wikipedia directories}}
|