Help:Wikitext: Difference between revisions

Content deleted Content added
 
(19 intermediate revisions by the same user not shown)
Line 5:
{{Wikipedia how to}}
{{Wikitext navbox}}
'''Wikitext''', also known as '''Wiki markup''' or '''Wikicode''', consists of the syntax and keywords used by the [[wikipedia:MediaWiki|MediaWiki]] software to format a page. To learn how to see this [[wikipedia:hypertext markup|hypertext markup]], and to save an edit, see [[wikipedia:Help:Editing|Help:Editing]]. Generally, coding can be copied and pasted, without writing new code. There is a short list of markup and tips at [[Help:Cheatsheet]].
 
In addition to Wikitext, some [[Wikipedia:HTML element|HTML element]]s are also allowed for presentation formatting. See [[Help:HTML in wikitext]] for information on this.
Line 740:
 
==Links and URLs==
{{Note|This whole section on links is better read on wikipedia, as the original links are there, here we had to prepend <code>Wikipedia:</code> to avoid many broken links. Original here: [[Wikipedia:Help:Wikitext#Links and URLs|Links and URLs]]}}
{{main|Wikipedia:Help:Link}}
 
Line 774 ⟶ 775:
|-
|
<code><nowiki>New York also has [[Wikipedia:public transport|public transportation]].</nowiki></code>
|
New York also has [[Wikipedia:public transport|public transportation]].
Line 781 ⟶ 782:
====Automatically rename links====
 
* Simply typing the pipe character | after a link will automatically rename the link in certain circumstances. The next time you open the edit box you will see the expanded piped link. When [[Wikipedia:Help:Show preview|previewing]] your edits, you will not see the expanded form until you press '''Save''' and '''Edit''' again. The same applies to [[#link-to-section|links to sections within the same page]].
* See [[Wikipedia:Help:Pipe trick|Pipe trick]] for details.
 
Line 902 ⟶ 903:
 
* [[Wikipedia:Redirect|Redirect]] one article title to another by placing a directive like the one shown to the right on the ''first'' line of the article (such as at a page titled "[[Wikipedia:US|US]]").
* It is possible to redirect to a section. For example, a redirect to [[Wikipedia:United States#History]] will redirect to the History section of the [[Wikipedia:United States|United States]] page, if it exists.
 
{| class="wikitable" border=1
Line 919 ⟶ 920:
|}
 
===Link to another [[Wikipedia:Help:namespace|namespace]]===
 
*The full page name should be included in double square brackets.
Line 928 ⟶ 929:
|-
|
<code><nowiki>See the [[WikipediaHelp:ManualProtecting ofand Styleunprotecting pages]].</nowiki></code>
|
See the [[Wikipedia:ManualHelp:Protecting ofand Styleunprotecting pages|Help:Protecting and unprotecting pages]].
|}
 
===Link to the same article in another language (interlanguage links)===
{{main|Wikipedia:Help:Interlanguage links|Wikipedia:Complete list of language wikis available}}
{{notice|After the launch of [[Wikipedia:Wikidata|Wikidata]], interlanguage links are now added through it. Links in articles should exist only in special cases, for example when an article in one language has two articles in another language.}}
 
Line 941 ⟶ 942:
* Interlanguage links are not visible within the formatted article, but instead appear as language links on the sidebar (to the left) under the menu section "languages".
 
* '''NOTE:''' To create an '''''inline link''''' (a clickable link within the text) to ''any'' foreign language article, see [[Wikipedia:Help:Interlanguage links#Inline interlanguage links]] and consider the usage notes.
 
{| class="wikitable"
Line 948 ⟶ 949:
|-
|
''Link from English article "Plankton" to the Spanish article [[Wikipedia:es:Plancton|"Plancton"]].''
 
''"es" is the language code for "{{lang|es|español}}" (the [[Wikipedia:Spanish language|Spanish language]]).''
|
<pre>
Line 971 ⟶ 972:
===Interwiki link===
 
* [[Wikipedia:Interwiki links|Interwiki links]] link to any page on other wikis. [[Wikipedia:Help:Interwikimedia links|Interwikimedia links]] link to other Wikimedia wikis.
* Note that interwikimedia links use the internal link style, with double square brackets.
* See [[MetaWikiPediaMetaWikimedia:Interwiki_map]] for the list of shortcuts; if the site you want to link to is not on the list, use an [[#External links|external link]].
* See also [[Wikipedia:Wikimedia sister projects|Wikimedia sister projects]].
 
Line 1,065 ⟶ 1,066:
 
*Single square brackets indicate an external link. Note the use of a ''space'' (not a pipe |) to separate the URL from the link text in a named link. Square brackets may be used as normal punctuation when not linking to anything – [like this].
*A [[Wikipedia:Uniform Resource Locator|URL]] must begin with a supported [[Wikipedia:URI scheme|URI scheme]]: <code>http://</code> and <code>https://</code> will be supported by all browsers; <code>irc://</code>, <code>ircs://</code>, <code>ftp://</code>, <syntaxhighlight lang="text" inline>news://</syntaxhighlight>, <code>mailto:</code>, and <code>gopher://</code> will require a plugin or an external application. IPv6 addresses in URLs are currently not supported.
*A URL containing certain characters will display and link incorrectly unless those characters are [[Wikipedia:Percent-encoding|percent encoded]]. For example, a space must be replaced by <code>%20</code>. Encoding can be achieved by:
:*Use the link button [[File:OOjs UI icon link-ltr.svg]] on the enhanced editing toolbar to encode the link; this tool will add the bracket markup and the linked text, which may not always be desirable.
:*Or manually encode the URL by replacing these characters:
Line 1,075 ⟶ 1,076:
| %20 || %22 || %27 || %2c || %3b || %3c || %3e || %3f || %5b || %5d
|}
:*Or use the <code><nowiki>{{urlencode:}}</nowiki></code> magic word. See [[:mw:Help:Magic words#URL data|Help:Magic words]] in the MediaWiki documentation for more details.
 
* See [[Wikipedia:External links]] for style issues, and [[:Category:External link file type templates]] for indicating the file type of an external link with an icon.
Line 1,085 ⟶ 1,086:
|-
|
''Named link'' with an [[Wikipedia:Help:external link icons|external link icon]]
|
<code><nowiki>[http://www.wikipedia.org Wikipedia]</nowiki></code>
Line 1,122 ⟶ 1,123:
 
===Automatic links===
{{main|Wikipedia:Help:Magic links}}
 
Magic links are automatic links for certain unique identifiers that require no markup. They can be used for ISBN numbers, RFC numbers, and PMID numbers.
Line 1,153 ⟶ 1,154:
====RFC number====
 
* Link to an [[Wikipedia:Internet Engineering Task Force|Internet Engineering Task Force]] [[Wikipedia:Request for Comments|Request for Comments (RFC)|]].
 
{| class="wikitable"
Line 1,225 ⟶ 1,226:
====Links partially italicized====
 
*Linking to a page with a title containing words that are usually italicized, such as the [[Wikipedia:Hindenburg disaster|''Hindenburg'' disaster]] article.
 
{| class="wikitable"
Line 1,234 ⟶ 1,235:
<code><nowiki>[[Hindenburg disaster|''Hindenburg'' disaster]]</nowiki></code>
|
[[Wikipedia:Hindenburg disaster|''Hindenburg'' disaster]]
|}
 
Line 1,264 ⟶ 1,265:
 
==Images==
{{Main page|Wikipedia:Help:Visual file markup|Wikipedia:Images}}
Only images that have been uploaded to Wikipedia or [[support-commons:Main Page|WikimediaSupport Commons]] can be used. To upload images, use the [[:support-commons:Special:UploadWizard|Commons upload wizard]] for photos you have taken, and thethis [[Special:Upload|Wikipediawiki's upload page]] if there may be copyright issues. You can find the uploaded image on the [[Special:Imagelist|image list]].
 
See the Wikipedia's [[Wikipedia:Image use policy|image use policy]] for the policy used on Wikipedia.
Line 1,450 ⟶ 1,451:
 
==References and citing sources==
{{main|Wikipedia:Citing sources|Wikipedia:Help:Footnotes}}
{{see also|Wikipedia:APA style|Wikipedia:The Chicago Manual of Style{{!}}Chicago style|Wikipedia:Harvard style|Wikipedia:MLA style}}
 
Making a reference citing a printed or online source can be accomplished by using the {{tag|ref}} tags. Inside these tags details about the reference are added.
Line 1,498 ⟶ 1,499:
==Templates and transcluding pages==
{{main|Wikipedia:Transclusion}}
{{see also|Wikipedia:Help:Template#Noinclude,|Wikipedia:Help:Template#includeonly|Wikipedia:Help:Template#onlyinclude |l2 = includeonly,|l3 and= onlyinclude}}
 
Examples for templates: <nowiki>{{pad|...}}, {{math|...}}, {{as of|...}}, {{edit}}</nowiki>
Line 1,505 ⟶ 1,506:
They are specified by putting the template's name in <nowiki>{{double braces}}</nowiki>. Most templates are pages in the [[wikipedia:WP:Template namespace|Template namespace]], but it is possible to transclude mainspace pages (articles) by using <nowiki>{{:colon and double braces}}</nowiki>.
 
There are three pairs of [[Wikipedia:html element|tags]] that can be used in [[Wikipedia:wikitext|wikitext]] to control how transclusion affects parts of a template or article.
They determine whether or not wikitext renders, either in its own article, which we will call "'''here'''", or in another article where it is transcluded, which we will call "'''there'''".
* '''<nowiki><noinclude></nowiki>: ''' the content '''will not be rendered ''there'''''. These tags have no effect ''here''.
* '''<nowiki><includeonly></nowiki>: ''' the content '''will render only ''there''''', and '''will not render ''here''''' (like [[Wikipedia:invisible ink|invisible ink]] made visible by means of transclusion).
* '''<nowiki><onlyinclude></nowiki>: ''' the content '''will render ''here''''' and '''will render ''there''''', but it will only render ''there'' what is between these tags.
There can be several such section "[[Wikipedia:HTML#Elements|elements]]". Also, they can be nested. All possible renderings are achievable. For example, to render ''there'' one or more sections of the page ''here'' use '''<nowiki><onlyinclude></nowiki>''' tags. To append text ''there'', wrap the addition in '''<nowiki><includeonly></nowiki>''' tags before, within, or after the section. To omit portions of the section, nest '''<nowiki><noinclude></nowiki>''' tags within it.
Line 1,877 ⟶ 1,878:
{{anchor|NOWIKI}}
{{redirect|wikipedia:WP:NOWIKI|the essay about the name "Wiki"|Wikipedia:Don't abbreviate "Wikipedia" as "Wiki"!}}
{{shortcut|H:NOWIKI|wikipedia:WP:NOWIKI}}
 
In order for the software to interpret wiki markup, its parser first scans the page. When it sees its nowiki tags
:{{tag|nowiki}} ([[Wikipedia:escape character|escape]]s all contained wiki markup), and
:{{tag|nowiki|s}} (escapes the interpretations it is designed to "break"),
it escapes its wikicode, so editors can document its markup ''using'' its markup.
Line 1,900:
<nowiki /># Ordered list
|<nowiki>A [[micro-]]second.</nowiki>
|A [[Wikipedia:micro-|micro-]]second.
|<nowiki>A [[micro-]]<nowiki />second.</nowiki>
|A [[Wikipedia:micro-|micro-]]<nowiki />second.
|<nowiki>a<nowiki>
 
Line 1,925:
:{{ ''pagename'' <nowiki />| {{ ''pagename'' }<nowiki />} }}
 
Unless you use the two "balanced" nowiki tags, troubleshooting [[Wikipedia:help:strip markers|strip marker]] errors and template parameter-handling inconsistencies is a risk. Also, a rendering error may arise when two <kbd>[<nowiki />[...]]</kbd> square brackets are on the same line, or two <kbd>{<nowiki />{...}}</kbd> curly brackets are in the same section, but only when the two have the nowiki markup placed inconsistently.
 
====Displaying wikilinks====
Line 1,996:
 
====Displaying magic words====
{{Further|Wikipedia:Help:Magic words|Wikipedia:Help:Parser function}}
 
For input '''parameters''', {{{1}}}, {{{2}}}, just write them out, unless they have a default (which goes behind their pipe):
Line 2,132:
 
==Invisible text (comments)==
{{see also|Wikipedia:Help:Hidden text|l1=Hidden text}}
 
It's uncommon{{spaced ndash}}but on occasion acceptable for notes to other editors{{spaced ndash}}to add a hidden comment within the text of an article. These comments are visible only when editing or viewing the source of a page. Most comments should go on the appropriate [[Wikipedia:Talk page|Talk page]]. <!-- This is an example of text that is not visible except in "edit" mode. --> The format is to surround the hidden text with "<code>&lt;!--</code>" and "<code>--&gt;</code>" and may cover several lines, e.g.:
Line 2,242:
{{main|Help:HTML in wikitext}}
 
Many [[Wikipedia:HTML]] tags can be used in wiki markup. You can check your HTML by using [[Wikipedia:Help:Markup validation|markup validation]].
 
==Notes==