User:Liflon/Help:維基代碼
維基代碼 |
---|
維基代碼是MediaWiki軟件用來決定頁面樣式的語法和關鍵詞。Help:備忘單有維基代碼的簡短入門;想知道如何檢閱頁面的代碼以及編輯頁面的話,可以去看Help:編輯頁面。
頁面排版
[编辑]章節
[编辑]章節標題
[编辑]“=
”到“======
”這幾組等號代碼是用來標示相應章節的標題的。
- 單獨的“=”會以頁面標題的樣式顯示,不應該用在頁面內。
- 各標題以CSS指定樣式,並且會添加“
[編輯]
”連結。 - 頁面內有四個章節標題或以上的話,便會自動生成頁面目錄。
- 不要在標題代碼後(同一行內)輸入其他代碼,因為這樣會使標題損壞,或者令標題不會出現在編輯摘要中。
代码 | 效果 |
---|---|
== 章節 == |
章節
|
=== 下層章節 === |
下層章節
|
==== 下下層章節 ==== |
下下層章節
|
如此類推。
維基式標題會轉換成HTML的標題元素<h1>
到<h6>
,並預設用以下樣式顯示:
相關模板:{{fake heading}},可以用在說明文檔中,會生成不顯示在頁面目錄裡的假標題。
水平線
[编辑]水平線代表段落之間主題上的分隔,不應該用在條目內容裡。
代码 | 效果 |
---|---|
---- |
|
HTML標籤:<hr />
頁面目錄
[编辑]頁面含有四個章節標題或以上時,頁面目錄便會自動出現在序言章節和第一個標題之間。這個目錄可以用魔術字或模板控制:
- “
__FORCETOC__
”會強制將目錄顯示在正常會出現的位置,不管頁面一共含有多少個章節標題。 - “
__TOC__
”會強制將目錄顯示在該魔術字出現的地方,而不是目錄正常會出現的位置。 - “
__NOTOC__
”會徹底隱藏目錄。 - 用
{{TOC limit}}
可以控制目錄所顯示的下層章節深度,在目錄太冗長時十分有用。 - Category:目錄模板收納了帶有特殊功能的不同目錄模板。
換行
[编辑]換行的作用是在不同行之間添加空白,例如分隔不同的段落。
- 要添加在內容裡看得到的換行,可以按兩下 ↵ Enter。
- 按一下 ↵ Enter 的話會在代碼中添加換行,但在生成內容時只會顯示為空格,除了使用列表標記時。
- 粗體和斜體等標記會在換行時終止。
代码 | 效果 |
---|---|
單次換行對頁面排版 並沒有任何影響,除了會添加空格。 空行則會開啟 新的段落,也會結束列表或 終止某段文字的縮進效果。 |
單次換行對頁面排版 並沒有任何影響,除了會添加空格。 空行則會開啟 新的段落,也會結束列表或 終止某段文字的縮進效果。 |
HTML標籤:<br>
或<br />
相關模板:
縮進文字
[编辑]縮進效果最常用於討論頁。
代码 | 效果 |
---|---|
在討論頁裡可以這樣使用縮進效果: :每行開頭的冒號 ::都會使該行文字縮進三個字母的空間。 :::(縮進效果會一直維持 直到遇上換行。) :::如果要換行,就要再次縮進。 ::::每次回覆時再添加一個冒號。 :::::如此…… ::::::類推…… |
在討論頁裡可以這樣使用縮進效果:
直到遇上換行。)
|
塊狀引用
[编辑]可以在需要分隔開一段文字時使用,尤其是添加一整段的引述文字時。
代码 | 效果 |
---|---|
<blockquote> 這個“'''blockquote'''”標籤會縮進頁面兩邊的空間,而不是像用冒號般只縮進左邊。 </blockquote> |
|
文字居中對齊
[编辑]代码 | 效果 |
---|---|
<div class="center" style="width:auto; margin-left:auto; margin-right:auto;">居中對齊的文字</div> |
居中對齊的文字
|
{{center}}模板用的是同樣的代碼。要將表格居中定位的話,參見Help:表格#表格居中。
不要用<center>...</center>
;這個標籤已經被廢除了。
文字靠右對齊
[编辑]代码 | 效果 |
---|---|
<div style="text-align:right; direction:ltr; margin-left:1em;">靠右對齊的文字</div> |
靠右對齊的文字
|
列表
[编辑]除非有特殊原因,否則不要在列表的各項之間留有空行,因為這樣會使MediaWiki軟件視每一項為另一個列表的開始。
無序列表
[编辑]代码 | 效果 |
---|---|
* 第1項 * 第2項 * 第3項 * 第4項 ** 第4項甲 *** 第4項甲(一) **** 第4項甲(一)i. **** 第4項甲(一)ii. ** 第4項乙 * 第5項 |
|
有序列表
[编辑]代码 | 效果 |
---|---|
# 第1項 # 第2項 # 第3項 # 第4項 ## 子項1 ### 子項 #### 子項 ## 子項2 # 第5項 |
|
定義列表
[编辑]要列出詞彙及其定義的話,在新的一行輸入分號(;)和該詞彙,接下來輸入冒號(:)和這個詞彙的定義。
定義列表由組名與其對應的賦值構成。組名(詞彙)會顯示為粗體文字,而賦值(定義)則會縮進排列。每一組內必須包含起碼一項定義。只有一項定義或者這個定義是一系列中的第一個時,“:
”可以與“;
”放在同一行裡,出現在其後面,但其餘定義必須另開新行放置。
注意:在沒有同時用冒號(:)添加定義的情況下,不要濫用分號(;)來將一行文字變成粗體。這種用法會生成不合規格的HTML5代碼。
代码 | 效果 |
---|---|
; 詞彙 : 定義1 |
|
; 詞彙 : 定義1 : 定義2 : 定義3 : 定義4 |
|
HTML標籤:<dl>
<dt>...</dt>
、<dd>...</dd>
</dl>
相關模板:{{defn}}
保留換行及空格
[编辑]MediaWiki軟件會遏制單次換行,還會將用空格開始的一行文字轉換成以虛線框包圍的預格式化文字,而HTML也會遏制連續出現的空格,但是這些被遏制的空白通常在詩詞、歌詞、箴言、誓詞和類似文字中卻是應該出現的。Poem擴展添加了類似HTML的<poem>...</poem>
標籤,可以保留換行和空格。這組標籤可以在其他標籤裡使用,例如<blockquote>...</blockquote>
;也可以指定CSS樣式,例如<poem style="margin-left:2em;">。
代码 | 效果 |
---|---|
<poem> 君不見黃河之水天上來, 奔流到海不復回? 君不見高堂明鏡悲白髮, 朝如青絲暮成雪? 人生得意須盡歡, 莫使金樽空對月。 天生我才必有用, 千金散盡還復來。 烹羊宰牛且為樂, 會須一飲三百杯。 岑夫子,丹丘生, 將進酒,杯莫停。 與君歌一曲, 請君為我傾耳聽: 鍾鼓饌玉不足貴, 但願長醉不願醒。 </poem> |
君不見黃河之水天上來, |
格式
[编辑]文字格式
[编辑]描述 | 代碼 | 效果 |
---|---|---|
|
要將''文字變成斜體''的話,可以在文字兩邊各輸入2個引號。 輸入3個引號會使'''文字變成粗體'''。 輸入5個引號會'''''變成粗斜體'''''。 '''''斜體和粗體 這兩種格式'''''只有在同一行內 才會生效。 要將文字變成小型大寫字母{{smallcaps|small caps}}的話, 需要用上[[Help:模板|模板]]。 |
要將文字變成斜體的話,可以在文字兩邊各輸入2個引號。 輸入3個引號會使文字變成粗體。 輸入5個引號會變成粗斜體。 斜體和粗體 這兩種格式只有在同一行內 才會生效。 要將文字變成小型大寫字母small caps的話,需要用上模板。 |
可以在正常文字當中添加一小段的代碼。 代碼會用等寬字體顯示。 |
這個子程式<code>int m2()</code>挺好的。 |
這個子程式 |
源代碼可以使用語法突顯。 電腦代碼可以用不同顏色顯示,而且有比較嚴格的格式。右邊的示例是子程式 |
<syntaxhighlight lang="cpp"> #include <iostream> int m2 (int ax, char *p_ax) { std::cout <<"Hello World!"; return 0; }</syntaxhighlight> |
#include <iostream>
int m2 (int ax, char *p_ax) {
std::cout <<"Hello World!";
return 0;
}
|
縮小文字 |
必要時可以將<small>文字縮小</small>。 用span標籤可以將文字的字體大小 變成<span style="font-size:87%">原來的87%</span>, 以配合圖片標題。 |
必要時可以將文字縮小。 用span標籤可以將文字的字體大小變成原來的87%,以配合圖片標題。 |
放大文字 |
最好不要將<big>文字放大</big>, 除非是<small>在一段<big>已縮小的</big> 文字</small>當中這樣做。 |
最好不要將文字放大,除非是在一段已縮小的文字當中這樣做。 |
You can include a non-breaking space (sometimes called non-printing character) where you require two words to always appear together on the same line, such as Mr. Smith or 400 km/h, using |
Mr. Smith or 400 km/h |
Mr. Smith or 400 km/h |
Extra spacing within text can best be achieved using the pad template. |
Mary {{pad|4em}} had a little lamb. |
Mary had a little lamb. |
Typewriter font (Also works beyond the end of a paragraph.) |
<tt>arrow →</tt> <tt>''italics'', '''bold'''</tt> <tt>[[link]] New paragraph </tt>started here. |
arrow → italics, bold New paragraph started here. |
Special characters
[编辑]Egyptian hieroglyphs
[编辑]WikiHiero is a software extension that renders Egyptian hieroglyphs as PNG images using <hiero>
tags.
Example:
代码 | 效果 | ||
---|---|---|---|
<hiero>P2</hiero> |
| ||
Chess symbols
[编辑]Diacritical marks
[编辑]What you type | What it looks like |
---|---|
À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ø Œ Ù Ú Û Ü Ÿ ß à á â ã ä å æ ç è é ê ë ì í î ï ñ ò ó ô õ ö ø œ ù ú û ü ÿ |
À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ø Œ Ù Ú Û Ü Ÿ ß à á â ã ä å æ ç è é ê ë ì í î ï ñ ò ó ô õ ö ø œ ù ú û ü ÿ |
Punctuation, special characters
[编辑]What you type | What it looks like |
---|---|
¿ ¡ § ¶ † ‡ • – — ‹ › « » ‘ ’ “ ” ' " |
¿ ¡ § ¶ † ‡ • – — ‹ › « » ‘ ’ “ ” ' " |
Other punctuation, escaping special characters
[编辑]The <pre>
and <nowiki>
markup tags are also available. (For writing "[", "{", "&", "}", "]", for example.)
Commercial symbols
[编辑]What you type | What it looks like |
---|---|
™ © ® ¢ € ¥ £ ¤ |
™ © ® ¢ € ¥ £ ¤ |
Subscripts and superscripts
[编辑]- The Manual of Style prefers the x<sub>1</sub> format.
- The latter methods of sub/superscripting cannot be used in the most general context, as they rely on Unicode support which may not be present on all users' machines. For the 1, 2, 3 superscripts, it is nevertheless preferred when possible (as with units of measurement) because most browsers have an easier time formatting lines with it.
Description | What you type | What it looks like |
---|---|---|
Subscripts |
x<sub>1</sub> x<sub>2</sub> x<sub>3</sub> or x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ |
x1 x2 x3 or x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ |
Superscripts |
x<sup>1</sup> x<sup>2</sup> x<sup>3</sup> or x⁰ x¹ x² x³ x⁴ x⁵ x⁶ x⁷ x⁸ x⁹ |
x1 x2 x3 or x⁰ x¹ x² x³ x⁴ x⁵ x⁶ x⁷ x⁸ x⁹ |
Combined |
ε<sub>0</sub> = 8.85 × 10<sup>−12</sup> C² / J m 1 [[hectare]] = [[1 E+4 m²]] |
ε0 = 8.85 × 10−12 C² / J m |
Greek characters
[编辑]What you type | What it looks like |
---|---|
α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω |
α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω |
Mathematical characters
[编辑]- See also WikiProject Mathematics and TeX.
What you type | What it looks like |
---|---|
∫ ∑ ∏ √ − ± ∞ ≈ ∝ ≡ ≠ ≤ ≥ × · ÷ ∂ ′ ″ ∇ ‰ ° ∴ ℵ ø ∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇ ¬ ∧ ∨ ∃ ∀ ⇒ ⇐ ⇓ ⇑ ⇔ → ↓ ↑ ← ↔ |
∫ ∑ ∏ √ − ± ∞ ≈ ∝ ≡ ≠ ≤ ≥ × · ÷ ∂ ′ ″ ∇ ‰ ° ∴ ℵ ø ∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇ ¬ ∧ ∨ ∃ ∀ ⇒ ⇐ ⇓ ⇑ ⇔ → ↓ ↑ ← ↔ |
Mathematical formulae
[编辑]- Formulae that include mathematical letters, like x, and operators like
×
should not use the plain letterx
. See math font formatting. For a comprehensive set of symbols, and comparison between<math>
tags and the {{math}} template see section TeX vs HTML.
- The
<math>
tag typesets using LaTeX markup, which may render as an image or as HTML, depending on environmental settings. The<math>
tag is best for the complex formula on its own line in an image format. If you use this tag to put a formula in the line with text, put it in the {{nowrap}} template.
- The {{math}} template uses HTML, and will size-match a serif font, and will also prevent line-wrap. All templates are sensitive to the
=
sign, so remember to replace=
with{{=}}
in template input. Use wikimarkup''
and'''
inside the{{math}} template, as well as other HTML entities. The {{math}} template is best for typeset formulas in line with the text.
代码 | 效果 | ||||
---|---|---|---|---|---|
<math>2x \times 4y \div 6z + 8 - \frac {y}{z^2} = 0</math> {{crlf|}} {{math|2x × 4y ÷ 6z + 8 − {{Fraction |y|z<sup>2</sup>}} {{=}} 0}} <math>\sin 2\pi x + \ln e\,\!</math> <math>\sin 2\pi x + \ln e</math> {{math|sin 2π''x'' + ln ''e''}} |
2x × 4y ÷ 6z + 8 −
| ||||
Spacing in simple math formulae
[编辑]- Using
to prevent line break is not needed; the {{math}} template will prevent line breaks anyway; you can use<br />
if you need an explicit line break inside a formula.
代码 | 效果 |
---|---|
It follows that {{math |''x''<sup>2</sup> ≥ 0}} is true when {{mvar|x}} is a real number. |
It follows that x2 ≥ 0 is true when x is a real number. |
Complicated formulae
[编辑]- See Help:Displaying a formula for how to use
<math>
. - A formula displayed on a line by itself should probably be indented by using the colon (:) character.
代码 | 效果 |
---|---|
: <math>\sum_{n=0}^\infty \frac{x^n}{n!}</math> |
|
Links and URLs
[编辑]Free links
[编辑]In Wikipedia and some other wikis, free links are used in wikitext markup to produce internal links between pages, as opposed to the concept of CamelCase for the same purpose, which was used in the early days of Wikipedia – see CamelCase and Wikipedia.
In Wikipedia's markup language, you create free links by putting double square brackets around text designating the title of the page you want to link to. Thus, [[Texas]]
will be rendered as Texas. Optionally, you can use a vertical bar (|) to customize the link title. For example, typing [[Texas|Lone Star State]]
will produce Lone Star State, a link that is displayed as "Lone Star State" but in fact links to Texas.
Link to another wiki article
[编辑]- Internally, the first letter of the target page is automatically capitalized and spaces are represented as underscores (typing an underscore in the link has the same effect as typing a space, but is not recommended).
- Thus the link hereafter is to the Web address
en.wikipedia.org/wiki/Public_transport
, which is the Wikipedia article with the name "Public transport". See also Canonicalization. - A red link is a page that doesn't exist yet; it can be created by clicking on the link.
- A link to its own page will appear only as bold text.
代码 | 效果 |
---|---|
London has [[public transport]]. |
London has public transport. |
Link to this article: "[[Help:Wiki markup]]" will appear only as bold text. |
Link to this article: "Help:Wiki markup" will appear only as bold text. |
Renamed link
[编辑]- Same target, different name.
- The target ("piped") text must be placed first, then the text to be displayed second.
What you type | What it looks like |
---|---|
|
New York also has public transportation. |
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 previewing your edits, you will not see the expanded form until you press Save and Edit again. The same applies to links to sections within the same page.
- See Pipe trick for details.
Description | What you type | What it looks like |
---|---|---|
Automatically hide stuff in parentheses |
|
|
Automatically hide the comma and following text | [[Seattle, Washington|]]
|
Seattle |
Automatically hide namespace |
|
|
Or both |
|
|
But this doesn't work for section links |
|
[[Wikipedia:Manual of Style#Links|]] |
Blend link
[编辑]- Endings are blended into the link.
- Exception: a trailing apostrophe (') and any characters following the apostrophe are not blended.
- Preferred style is to use this instead of a piped link, if possible.
- Blending can be suppressed by using the
<nowiki />
tag, which may be desirable in some instances.
Description | What you type | What it looks like |
---|---|---|
Blending active |
|
San Francisco also has public transportation. Examples include buses, taxicabs, and trams. |
Blending suppressed |
|
A micro-second |
Link to a section of a page
[编辑]- The part after the hash sign (#) must match a section heading on the page. Matches must be exact in terms of spelling, case, and punctuation. Links to non-existent sections are not broken; they are treated as links to the beginning of the page.
- Include "| link title" to create a stylish (piped) link title.
- If sections have the same title, add a number to link to any but the first. #Example section 3 goes to the third section named "Example section". You can use the pipe and retype the section title to display the text without the # symbol.
What you type | What it looks like |
---|---|
|
Wikipedia:Manual of Style#Italics is a link to a section within another page. |
|
#Links and URLs is a link to another section on the current page. Links and URLs is a link to the same section without showing the # symbol. |
|
Italics is a piped link to a section within another page. |
Create page link
[编辑]- To create a new page:
- Create a link to it on some other (related) page.
- Save that page.
- Click on the link you just made. The new page will open for editing.
- For more information, see starting an article and check out Wikipedia'snaming conventions.
- Please do not create a new article without linking to it from at least one other article.
Description | What you type | What it looks like |
---|---|---|
Links to pages that don’t exist yet look red. |
|
The article about cardboard sandwiches doesn't exist yet. |
Redirects
[编辑]- Redirect one article title to another by placing a directive like the one shown to the right on thefirst line of the article (such as at a page titled "USA").
- 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.
Description | What you type |
---|---|
Redirect to an article |
|
Redirect to a section |
|
What you type | What it looks like |
---|---|
|
See the Wikipedia:Manual of Style. |
Link to the same article in another language (interlanguage links)
[编辑]This section needs to be updated to include Wikidata. |
- To link to a corresponding page in another language, use the form:
[[language code:Foreign title]]
. - It is recommended interlanguage links be placed at the very end of the article.
- 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, seeHelp:Interlanguage links#Inline interlanguage links and consider the usage notes.
Description | What you type |
---|---|
Link from English article "Plankton" to the Spanish article "Plancton". "es" is the language code for "español" (the Spanish language). |
[[es:Plancton]] |
Other examples: French ( |
[[fr:Plancton]] [[de:Plankton]] [[ru:Планктон]] [[simple:Plankton]] |
- Link to any page on other Wikimedia wikis.
- Note that interwiki links use the internal link style.
- See MetaWikiPedia:Interwiki_map for the list of shortcuts; if the site you want to link to is not on the list, use an external link (see hereafter).
- See also Wikimedia sister projects.
Description | What you type | What it looks like |
---|---|---|
Linking to a page on another wiki in English. All of these forms lead to the URL http://en.wiktionary.org/wiki/Hello. | ||
Simple link. Without prefix. Named link. |
|
|
Linking to a page on another wiki in another language. All of these forms lead to the URL http://fr.wiktionary.org/wiki/bonjour. | ||
Simple link. Without prefix. Named link. |
|
Categories
[编辑]- To put an article in a category, place a link like
[[Category:Example]]
into the article. As with interlanguage links, placing these links at the end of the articleis recommended. - To link to a category page without putting the article into the category, use a colon prefix (":Category") in the link.
Description | What you type | What it looks like |
---|---|---|
Categorize an article. |
|
|
Link to a category. |
|
|
Without prefix. |
|
External links
[编辑]- Square brackets indicate an external link. Note the use of a space (not a pipe) to separate the URL from the link text in the "named" link. Square brackets may be used as normal when not linking to anything – [like this].
- A URL must begin with a supported URI scheme:
http://
andhttps://
will be supported by all browsers;irc://
,ircs://
,ftp://
,news://
,mailto:
andgopher://
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 encoded. For example, a space must be replaced by
%20
. Encoding can be achieved by:
space | " | , | ' | ; | < | > | ? | [ | ] |
---|---|---|---|---|---|---|---|---|---|
%20 | %22 | %2c | %27 | %3b | %3c | %3e | %3f | %5b | %5d |
- Or use the {{urlencode:}} magic word. See Help:Magic words in the MediaWiki documentation for more details.
- See External links for style issues, and External link file type templates for indicating the file type of an external link with an icon.
Description | What you type | What it looks like |
---|---|---|
Named link with an external link icon |
|
|
Unnamed link (Only used within article body for footnotes) |
|
|
Bare URL (Bad style) |
|
|
Link without arrow (Not often used) |
|
Miscellaneous
[编辑]"As of" tag
[编辑]- "As of" tags generate phrases like "As of April 2009" or "as of April 2009", and categorize info that will need updating. For an explanation of the parameters see template documentation.
What you type | What it looks like |
---|---|
|
截至2009年4月[update] |
|
截至2009年4月[update] |
Media link
[编辑]- To include links to non image uploads such as sounds, use a "media" link. For images, see next section.
- Some uploaded sounds are listed at Commons:Sound.
What you type | What it looks like |
---|---|
|
Links directly into edit mode
[编辑]Description | What you type | What it looks like |
---|---|---|
Full URL |
|
//wikicn.playgoteam.workers.dev/w/index.php?title=Help:Wiki_markup&action=edit |
"Edit" label |
|
Automatic links
[编辑]Book sources
[编辑]- Link to books using their ISBN, which creates a link to Special:BookSources. This is preferred to linking to a specific online bookstore, because it gives the reader a choice of vendors. However, if one bookstore or online service provides additional free information, such as table of contents or excerpts from the text, then a link to that source will aid the user and is recommended. ISBN links do not need any extra markup, provided you use one of the indicated formats.
- To create a link to Special:BookSources using alternative text (e.g. the book's title), use the internal link style with the appropriate namespace.
What you type | What it looks like |
---|---|
|
|
|
|
|
Link to a book using alternative text, such as its title |
RFC number
[编辑]What you type | What it looks like |
---|---|
|
Text mentioning an RFC number anywhere, e.g. RFC 4321. |
Links partially italicized
[编辑]- Link to a page with words usually italicized, such as Hindenburg disaster.
What you type | What it looks like |
---|---|
|
Pronunciation aids
[编辑]It is often desirable to provide an aid to pronunciation for a word. The IPAc-en andRespell templates can be of assistance.
What you type | What it looks like | |
---|---|---|
|
Konjac 英語 發音: /ˈkoʊnjæk/ | |
|
Konjac (英語 發音: /ˈkoʊnjæk/ KOHN-yak) |
|
|
Konjac is pronounced /ˈkoʊnjæk/ in English. |
Refer to Wikipedia:Manual of Style (pronunciation) for more information.
Musical notation
[编辑]Musical notation is added by using the <score>……</score>
extension tag. For example:
代码 | 效果 |
---|---|
<score>\relative c' { fis d fis a d f e d c cis d e a g f ees }</score> |
|
Images
[编辑]Only images that have been uploaded to Wikipedia can be used. To upload images, use the upload page. You can find the uploaded image on the image list.
What you type | What it looks like | Notes | |
---|---|---|---|
A picture: [[File:wiki.png]] |
A picture: | ||
With alternative text: [[File:wiki.png|alt=Puzzle globe logo]] |
With alternative text: |
| |
With link: [[File:wiki.png|link=Wikipedia]] |
With link: |
| |
Floating to the right side of the page using the ''frame'' attribute and a caption: [[File:wiki.png|frame|alt=Puzzle globe|Wikipedia logo]] |
Floating to the right side of the page using the frame attribute and a caption:
|
| |
Floating to the right side of the page using the ''thumb'' attribute and a caption: [[File:wiki.png|thumb|alt=Puzzle globe|Wikipedia logo]] |
Floating to the right side of the page using the thumb attribute and a caption:
|
| |
Floating to the right side of the page ''without'' a caption: [[File:wiki.png|right|Wikipedia encyclopedia]] |
Floating to the right side of the page without a caption: |
| |
A picture resized to 30 pixels... [[File:wiki.png|30 px|Wikipedia encyclopedia]] |
A picture resized to 30 pixels... |
| |
Linking directly to the description page of an image: [[:File:wiki.png]] |
Linking directly to the description page of an image: |
| |
Linking directly to an image without displaying it: [[Media:wiki.png|Image of jigsaw globe]] |
Linking directly to an image without displaying it: |
| |
Example: <div style="display: inline; width: 220px; float: right;"> Place images here </div> |
Example:
Place images here
|
Using the | |
Example: {| align=right |- | Place images here |} |
Example:
|
Using wiki markup to make a table in which to place a vertical column of images (this helps edit links match headers, especially in Firefox browsers). |
See the Wikipedia's image use policy as a guideline used on Wikipedia.
For further help on images, including some more versatile abilities, see the picture tutorial.
Tables
[编辑]There are two ways to build tables:
- In special wiki-markup (see Help:Table).
- Using HTML elements:
<table>
,<tr>
,<td>
or<th>
.
See also When tables are appropriate.
References and citing sources
[编辑]Making a reference citing a printed or online source can be accomplished by using the <ref>...</ref>
tags. Inside these tags details about the reference are added.
Details about the citation can be provided using a structure provided by various templates; the table below lists some typical citation components.
What it's for | What you type |
---|---|
To create the reference | <ref name="name for reference">Use a closing tag</ref>
|
To cite a book | {{cite book}}
|
To cite a web source | {{cite web}}
|
Book ISBN | |isbn=0-4397-0818-4 (ISBN of the book)
|
Web URL | |url=http://www.wikipedia.org
|
Title | |title=title of source
|
Author | |author=authors, use commas for multiple
|
First name | |first=first name
|
Last name | |last=last name
|
Location | |location=location of publisher
|
Publisher | |publisher=who published the source
|
Date | |date=2007-09-21 (date of source)
|
Year | |year=year of source
|
Accessed date | |accessdate=2008-12-25
|
A complete reference tag | <ref name="WikiMarkup"> {{cite web |url=http://en.wikipedia.org/w/index.php?title=Help:Wiki_markup |title=Help:Wiki markup |publisher=Wikimedia Foundation}} </ref>
|
Referencing this again | <ref name="WikiMarkup" />
|
Citation needed | {{citation needed}}
|
Templates and transcluding pages
[编辑]Examples for templates: {{pad|...}}, {{math|...}}, {{as of|...}}, {{edit}}
Templates are segments of wiki markup that are meant to be copied automatically ("transcluded") into a page. You add them by putting the template's name in {{double braces}}. It is also possible to transclude other pages by using {{:colon and double braces}}.
There are three pairs of tags that can be used in 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".
- <noinclude>: the content will not be rendered there. These tags have no effect here.
- <includeonly>: the content will render only there, and will not render here(like invisible ink made visible by means of transclusion).
- <onlyinclude>: 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 "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 <onlyinclude> tags. To append text there, wrap the addition in <includeonly> tags before, within, or after the section. To omit portions of the section, nest <noinclude> tags within it.
If a page is transcluded without transclusion markup, it may cause an unintentionalcategorization. Any page transcluding it will contain the same category as the original page. Wrap the category markup with <noinclude> tags to prevent incorrect categorization.
Some templates take parameters, as well, which you separate with the pipe character |
.
What you type | What it looks like |
---|---|
{{Transclusion demo}} |
|
{{Help:Transclusion demo}} |
|
This template takes two parameters, and creates underlined text with a hover box for many modern browsers supporting CSS: {{SetTitle|This is the hover text| Hover your mouse over this text}} Go to this page to see the H:title template itself: {{tl|H:title}} |
This template takes two parameters, and creates underlined text with a hover box for many modern browsers supporting CSS: Hover your mouse over this text Go to this page to see the H:title template itself: {{H:title}} |
Talk and project pages
[编辑]Signing comments
[编辑]- The character tilde (~) is used when adding a comment to a Talk page.
- Your username provides a link to your user page.
Description | What you type | What it looks like |
---|---|---|
You should sign your comments by appending four tildes to the comment, which adds your user name plus date/time. |
|
|
Adding three tildes will add just your user name. |
|
|
Adding five tildes gives the date/time alone. |
|
12:06, 21 11月 2024 (UTC) |
What links here and related changes
[编辑]What you type | What it looks like |
---|---|
[[Special:WhatLinksHere/aaa]] |
|
[[Special:RecentChangesLinked/aaa]] |
Linking to old revisions of pages, diffs, and specific history pages
[编辑]- External link function is mainly used for these.
- Open an old revision or diff and copy the URL from the address bar, pasting it where you want it.
What you type | What it looks like |
---|---|
|
- For an old revision, you can also use a permalink. Though here only the main text is guaranteed to be retained (images and templates will be shown as they are today, not as they were at the time).
What you type | What it looks like |
---|---|
|
User edits
[编辑]- Link to a user's Contributions page.
Description | What you type | What it looks like |
---|---|---|
Username (registered users). | [[Special:Contributions/UserName]]
|
Special:Contributions/UserName |
IPv4 address (unregistered users). | [[Special:Contributions/192.0.2.0]]
|
Special:Contributions/192.0.2.0 |
IPv6 address (unregistered users). | [[Special:Contributions/2001:0db8:0000:0000:0000:ff00:0042:8329]]
|
Special:Contributions/2001:0db8:0000:0000:0000:ff00:0042:8329 |
Coloring text
[编辑]What you type | What it looks like |
---|---|
|
I will change the color in the middle part of this sentence. |
Highlighting text
[编辑]What you type | What it looks like |
---|---|
|
This is how to highlight part of a sentence. |
Show deleted or inserted text
[编辑]- When editing regular Wikipedia articles, just make your changes and do not mark them up in any special way.
- When editing your own previous remarks in talk pages, it is sometimes appropriate to mark up deleted or inserted content.
- To indicate deleted content use
<del>...</del>
. - To indicate inserted content use
<ins>...</ins>
.
- To indicate deleted content use
代码 | 效果 |
---|---|
You can <del>strike out deleted content</del> and <ins>underline new content</ins>. |
You can |
Limiting formatting / escaping wiki markup
[编辑]A few different kinds of formatting will tell the wiki to display things as you typed them – what you see is what you get!
What you type | What it looks like |
---|---|
'''<nowiki> tag:''' <nowiki> The nowiki tag ignores [[wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets characters specified by &name;: → </nowiki> |
<nowiki> tag: The nowiki tag ignores [[wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets characters specified by &name;: → |
'''<pre> tag:''' <pre>The <pre> tag ignores [[wiki]] ''markup'' as does the <nowiki> tag. Additionally, <pre> displays in a mono-spaced font, and does not reformat text spaces. It still interprets special characters: → </pre> |
<pre> tag: The <pre> tag ignores [[wiki]] ''markup'' as does the <nowiki> tag. Additionally, <pre> displays in a mono-spaced font, and does not reformat text spaces. It still interprets special characters: → |
'''[Text without a URL]:''' Single square brackets holding [text without a HTTP URL] are preserved, but single square brackets containing a URL are treated as being an external [http://example.com/ Web link]. |
[Text without a URL]: Single square brackets holding [text without a HTTP URL] are preserved, but single square brackets containing a URL are treated as being an external Web link. |
'''Leading space:''' Leading spaces are another way to preserve formatting. Putting a space at the beginning of each line stops the text from being reformatted. It still interprets [[wiki]] ''markup'' and special characters: → |
Leading space: Leading spaces are another way to preserve formatting. Putting a space at the beginning of each line stops the text from being reformatted. It still interprets wiki markup and special characters: → |
Nowiki
[编辑]<nowiki>...</nowiki>
and <nowiki />
tags stop parsing of wiki markup, except HTML character entity references (e.g. for special characters). Unlike <pre>
, "nowiki" doesn't change formatting.
An example of <nowiki>...</nowiki>
:
代码 | 效果 |
---|---|
<nowiki>{{cite book}}</nowiki> |
{{cite book}} |
(However in this particular case probably you prefer {{tl|cite book}} to create a link as {{cite book}}, or{{tlf|cite book}} prints {{cite book}}.)
A singular <nowiki />
can be used to break wikimarkup.
- Markup such as
*
,#
,;
and:
only and always take effect at the beginning of a line. A<nowiki />
before the markup will cause the characters to not parse as markup. - An internal link immediately followed by characters are blended to form a single link. Where this is not desired, add a
<nowiki />
after the link. - HTML(-like) tags can be stopped parsing by inserting
<nowiki />
after the opening angle bracket.
代码 | 效果 |
---|---|
* Unordered list |
|
<nowiki />* Unordered list |
* Unordered list |
A [[micro-]]second. |
A micro-second. |
A [[micro-]]<nowiki />second. |
A micro-second. |
'<nowiki />'We don't want italics.'<nowiki />' |
''We don't want italics.'' |
[[<nowiki />Example]] |
[[Example]] |
[<nowiki />[[Example]]] |
[Example] |
No <<nowiki />br />line break. But for tag pairs, you need nowiki for the closing tag, too. <<nowiki />pre>The following /pre is gone!</pre> |
No <br />line break. But for tag pairs, you need nowiki for the closing tag, too. <pre>The following /pre is gone!
|
If you want to write tags, {{tag}} template is handy. E.g. {{tag|nowiki}} prints <nowiki>...</nowiki>
.
HTML entities
<nowiki>
and <pre>
parse HTML entities. If you want to escape this, replace &
with &
.
代码 | 效果 |
---|---|
<nowiki>&</nowiki> |
|
<nowiki><</nowiki> |
|
<nowiki>&amp;</nowiki> |
|
<nowiki>&lt;</nowiki> |
|
Use in templates
When used in a template, <nowiki>
simply does not work as you may expect.
- Including
<nowiki>
immediately acts upon the enclosed markup. Attempting to escape or transclude the brackets causes<nowiki />
to not work at all. - Using
#tag:nowiki
works, but has major limitations:- Templates, parameters, parser functions, and parser magic such as signatures are parsed, not nowikied.
- Included
<ref>
tags will expose the strip markers.
代码 | 效果 |
---|---|
<nowiki>{{tl|cite book}}</nowiki> |
{{tl|cite book}} |
{{#tag:nowiki|{{tl|cite book}}}} |
{{[[Template:cite book|cite book]]}} |
{{#tag:nowiki|<ref>Text</ref>}} {{reflist}} |
|
Pre
[编辑]<pre>
is a parser tag that emulates the HTML <pre>
tag. It defines preformatted text that is displayed in a fixed-width font and is enclosed in a dashed box. HTML and wiki markups are escaped and spaces and line breaks are preserved, but HTML entities are parsed.
代码 | 效果 |
---|---|
<pre><!--Comment--> [[wiki]] markup &</pre> |
<!--Comment--> [[wiki]] markup & |
<pre>
formatted text does not wrap, thus text may extend past the browser window:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
To resolve this, <pre>
may use CSS styling to add wrapping or a horizontal scrollbar:
- Wrapping:
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
- Scroll bar:
<pre style="overflow:auto; width:auto;">
Alternatively, consider using {{pre2}} template or <syntaxhighlight enclose="div" lang="text">……</syntaxhighlight>
.
Invisible text (comments)
[编辑]It's uncommon – but on occasion acceptable for notes to other editors – to add a hidden comment within the text of an article. These comments are only visible when editing or viewing the source of a page. Most comments should go on the appropriate Talk page. The format is to surround the hidden text with "<!--
" and "-->
" and may cover several lines, e.g.:
<!-- An example of hidden comments This won't be visible except in "edit" mode. -->
Another way to include a comment in the wiki markup uses the {{Void}} template, which can be abbreviated as {{^}}. This template "expands" to the empty string, generating no HTML output; it is visible only to people editing the wiki source. Thus Template:J operates similarly to the comment Template:J. The main difference is that the template version can be nested, while attempting to nest HTML comments produces odd results.
Variables
[编辑]命名空间 | ||||
---|---|---|---|---|
基本命名空间 | 讨论命名空间 | |||
0 | (主/條目) | 帮助 | 讨论 | 1 |
2 | 用戶 | 帮助 | 用户讨论 | 3 |
4 | 维基百科 | 维基百科讨论 | 5 | |
6 | 文件 | 帮助 | 文件讨论 | 7 |
8 | MediaWiki | MediaWiki讨论 | 9 | |
10 | 模板 | 帮助 | 模板讨论 | 11 |
12 | 帮助 | 帮助讨论 | 13 | |
14 | 分类 | 帮助 | 分类讨论 | 15 |
100 | 主题 | 主题讨论 | 101 | |
102 | 維基專題 | 維基專題討論 | 103 | |
118 | 草稿 | 草稿讨论 | 119 | |
126 | 格式手册快捷方式 | PNS | 格式手册快捷方式讨论 | 127 |
710 | 字幕 | 字幕討論 | 711 | |
828 | 模块 | 模块讨论 | 829 | |
1728 | 活动 | 活动讨论 | 1729 | |
2600 | 话题 | 帮助 | ||
虚拟命名空间 | ||||
-1 | 特殊 | |||
-2 | 媒体 | |||
Code | Effect | Notes |
---|---|---|
{{CURRENTWEEK}} | 47 | |
{{CURRENTDOW}} | 4 |
Monday = 1, Tuesday = 2, etc., but Sunday = 0 |
{{CURRENTMONTH}} | 11 | |
{{CURRENTMONTHNAME}} | 11月 | |
{{CURRENTMONTHNAMEGEN}} | 11月 | |
{{CURRENTDAY}} | 21 | |
{{CURRENTDAYNAME}} | 星期四 | |
{{CURRENTYEAR}} | 2024 | |
{{CURRENTTIME}} | 12:06 | |
{{NUMBEROFARTICLES}} | 1,451,647 | |
{{NUMBEROFPAGES}} | 7,871,061 | |
{{NUMBEROFUSERS}} | 3,620,652 | |
{{PAGENAME}} | Liflon/Help:維基代碼 | |
{{NAMESPACE}} | User | |
{{REVISIONID}} | - | |
{{REVISIONUSER}} | Antigng | |
{{localurl:pagename}} | /wiki/Pagename | |
{{localurl:Wikipedia:Sandbox|action=edit}} | /w/index.php?title=Wikipedia:Sandbox&action=edit | |
{{fullurl:pagename}} | //wikicn.playgoteam.workers.dev/wiki/Pagename | |
{{fullurl:pagename|query_string}} | //wikicn.playgoteam.workers.dev/w/index.php?title=Pagename&query_string | |
{{SERVER}} | //wikicn.playgoteam.workers.dev | |
{{ns:1}} | Talk |
{{ns:index}} e.g. {{ns:1}} → full name of namespace |
{{SITENAME}} | Wikipedia |
{{NUMBEROFARTICLES}} is the number of pages in the main namespace which contain a link and are not a redirect. This includes full articles, stubs containing a link, and disambiguation pages.
{{CURRENTMONTHNAMEGEN}} is the genitive (possessive) grammatical form of the month name, as used in some languages but not in English; {{CURRENTMONTHNAME}} is the nominative (subject) form, as usually seen in English.
In languages where it makes a difference, you can use constructs like {{grammar:case|word}}
to convert a word from the nominative case to some other case. For example, {{grammar:genitive|{{CURRENTMONTHNAME}}}}
means the same as {{CURRENTMONTHNAMEGEN}}
.
HTML
[编辑]Many HTML tags can be used in wiki markup. You can check your HTML by using markup validation.