帮助:Wiki标记式语言
Wiki标记式语言,又称Wiki语法,包含了许多参数与关键字,可将MediaWiki软件内的页面进行格式的编排。关于如何阅读这种标记式语言,以及如何储存编辑,请参考Help:编辑页面。一般而言,这些语法可以不用重新撰写而能够复制与粘贴。
除了Wiki标记式语言外,部分HTML元素也能够进行格式编排。相关信息请参考Help:HTML。 模板:TOC limit
布局[编辑]
章节[编辑]
一份页面的章节应遵循页面的心百科:序言章节以及(在特定情形下)心百科:章节目录规范。
章节标题[编辑]
「= 标题 =
」至「====== 标题 ======
」标记为章节的标题语法,彼此具有关连性。
- 一个单一的「=」被规定为条目的标题,不应用于条目内容。
- 标题的样式由CSS规范并增加一个「
[编辑]
」连结。相关的CSS语法请参考这里。 - 四个以上的章节标题会自动生成章节目录。
- 不得在标题语法最后使用任何语法,这将会导致章节标题格式消失,或是无法在编辑摘要中自动包含章节标题名称。
{{fake heading}}用于模板等说明文件。
水平线[编辑]
水平线代表章节层级主题的终止。请不要使用于条目内容,因为该语法仅能用于主要章节之后,而且会自动生成。
代码 | 效果 |
---|---|
|
|
HTML等效语法:<hr />
目录表[编辑]
当某个页面包含4个以上的章节标题时,将会在首段与第一个章节标题之间自动生成章节目录。章节目录可由魔术字或模板控制:
- 「
__FORCETOC__
」将强制章节目录自动显示于正常位置,无论章节标题数量为何。 - 「
__TOC__
」将会使章节目录从正常位置移动到魔术字插入的位置。 - 「
__NOTOC__
」将会不显示章节目录。 - 「{{TOC limit}}」可用于控制章节目录所包含的章节层级,当某个条目的章节数量与层级太多时非常有用。
- Category:目录模板包含特定的章节目录模板。
断行[编辑]
断行或是产生新行藉由在两行之间增加空白而生成,例如分开段落。
- 在条目内容内显示一个明显的断行,请输入两次模板:Key press。
- 输入一次模板:Key press会在标记式语言编辑画面中显示为断行,但输出内容中只会形成一个空格。使用清单语法时例外。
- 粗体或斜体等标记式语言会在断行处终结。
代码 | 效果 |
---|---|
在此处进行一次断行 不会影响输出格式。 但空出一行代表新段落的开始, 或是某个清单或缩排内容的终止。 |
模板:Crlf2 在此处进行一次断行 不会影响输出格式。 但空出一行代表新段落的开始, 或是某个清单或缩排内容的终止。 |
HTML等效语法:<br>
或<br />
。
模板:
- 「{{break}}」可增加多个断行。
- 「{{-}}」与「{{clear}}」可增加样式方面的断行,以终止浮动元素的适用。
- 「{{plainlist}}」与「{{unbulleted list}}」两者可增加一份没有项目符号的清单。
文字缩排[编辑]
文字缩排最常用于讨论页面。
代码 | 效果 |
---|---|
|
缩排用于讨论页面的方式:
缩排仍然会存在。)
模板:OutdentOutdent模板可以给予刻意取消缩排的一个视觉指示(此处为刻意取消6层缩排) |
区块引言[编辑]
如有需要将文字独立为区块时可以使用。就如同字面所说,这对于插入一份引言或引用文字而言非常有用。
代码 | 效果 |
---|---|
|
|
文字置中[编辑]
代码 | 效果 |
---|---|
|
置中的文字
|
{{center}}模板也能达到上述语法的效果。如果要将表格置中,请参考Help:表格#表格居中。请不要使用<center>...</center>
,因为该标签已过时。
文字靠右[编辑]
您可以将靠右的内容放入独立的容器中:
代码 | 效果 |
---|---|
|
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.
靠右的文字 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.
|
或者您可以让文字以浮动方式显现:
代码 | 效果 |
---|---|
|
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.
靠右的文字 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.
|
|
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.模板:StackLorem 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. |
列表[编辑]
除非有理由,否则不要在同一列表内的项目之间加入空白行,因为这将会导致MediaWiki软件判定空白行后面的项目为新列表的开头。
无序号列表[编辑]
代码 | 效果 |
---|---|
|
|
有序号列表[编辑]
代码 | 效果 |
---|---|
|
|
==== 描述列表==== 模板:Anchors 模板:Shortcut
如果需要列出术语及定义,请使用半形分号(;)在术语之前。接者在定义前面放上半形冒号(:)。这种格式可用于其他目的,例如车辆型号介绍等。
描述列表(前称定义列表,也就是关连列表)由群组名称与对应的值所组成。群组名称(术语)为粗体,值(定义)则进行缩排。每个群组必需包含一个以上的定义。对于单一值或第一个值,可将「:
」放置于「;
」所在行之后──但随后的值必需各自独立成一行。
代码 | 效果 |
---|---|
|
|
|
|
HTML等效语法:<dl>
<dt>...</dt>
、<dd>...</dd>
</dl>
模板:{{defn}}
保留换行与空白[编辑]
MediaWiki预设无法使用单次换行,并将以空格为开头的单行文字转换成虚线文字方块。HTML则无法使用多个空白。通常诗句、歌词、格言、誓词或类似内容会需要保留这些元素。诗词扩展元素增加了类HTML的<poem>...</poem>
标签来保留换行与空白特色。这对标签可以用在其他标签当中,如<blockquote>...</blockquote>
;而{{poemquote}}
提供较为方便的使用途径。本标签也适用CSS风格,如<poem style="margin-left: 2em;">
。
代码 | 效果 |
---|---|
|
<poem> In Xanadu did Kubla Khan A stately pleasure-dome decree: Where Alph, the sacred river, ran Through caverns measureless to man Down to a sunless sea. So twice five miles of fertile ground With walls and towers were girdled round: And there were gardens bright with sinuous rills, Where blossomed many an incense-bearing tree; And here were forests ancient as the hills, Enfolding sunny spots of greenery. </poem> |
诗词以及其翻译可以用两侧对照方式呈现,其对译语言以lang="xx"
标明。在最后一个两侧对照区段以后,必需使用{{Clear|left}}
模板来取消"float:left;"
并回复成正常模式。请注意本方法不需要使用表格,此法将会自己生成多个翻译对照的栏位。
程序码
<poem lang="fr" style="float:left;">Frère Jacques, frère Jacques,
Dormez-vous? Dormez-vous?
Sonnez les matines! Sonnez les matines!
Ding, dang, dong. Ding, dang, dong.</poem>
<poem style="margin-left:2em; float:left;">贾克修士,贾克修士,
您在睡觉吗?您在睡觉吗?
快去敲做日课的钟!快去敲做日课的钟!
叮,叮,铛。叮,叮,铛。</poem>{{Clear|left}}
效果 <poem lang="fr" style="float:left;">Frère Jacques, frère Jacques, Dormez-vous? Dormez-vous? Sonnez les matines! Sonnez les matines! Ding, dang, dong. Ding, dang, dong.</poem> <poem style="margin-left:2em; float:left;">贾克修士,贾克修士, 您在睡觉吗?您在睡觉吗? 快去敲做日课的钟!快去敲做日课的钟! 叮,叮,铛。叮,叮,铛。</poem>模板:Clear
格式[编辑]
文字格式[编辑]
描述 | 输入内容 | 输出结果 |
---|---|---|
斜体、粗体、小型大写字体(模板:Smallcaps) |
如果要''将文字斜体化'',请在文字两侧放上2个连续的半形撇号。
两侧放上3个半形撇号将会'''使文字变粗体'''。
两侧放上5个连续半形撇号(2个撇号为斜体,3个撇号为粗体)将会形成'''''粗斜体'''''。
'''''粗体与斜体格式'''''只能在单行以内正确显示。
如果要产生小型大写字体({{smallcaps|small caps}}),请使用{{tl|smallcaps}}模板。 |
如果要将文字斜体化,请在文字两侧放上2个连续的半形撇号。 两侧放上3个半形撇号将会使文字变粗体。 两侧放上5个连续半形撇号(2个撇号为斜体,3个撇号为粗体)将会形成粗斜体。 粗体与斜体格式只能在单行以内正确显示。 如果要产生小型大写字体(模板:Smallcaps),请使用{{smallcaps}}模板。 |
单行普通文字当中的一小句原始码。 原始码会采用等宽字体显示。 |
<code>int m2()</code>功能很好。 |
|
针对原始码进行突显参数。 计算机原始码具有上色文字以及更严谨的格式。举例,函数 对于所有支援此功能的程序语言列表,请参考这里,其语言-{zh-hant:代码;zh-hans:代码;}-需放置在 |
<syntaxhighlight lang="cpp">
#include <iostream>
int m2 (int ax, char *p_ax) {
std::cout <<"Hello World!";
return 0;
}</syntaxhighlight> 或是(产生效果实际上一模一样,但该语法已废弃) <source lang="cpp">
#include <iostream>
int m2 (int ax, char *p_ax) {
std::cout <<"Hello World!";
return 0;
}</source> |
#include <iostream>
int m2 (int ax, char *p_ax) {
std::cout <<"Hello World!";
return 0;
}
|
小型字 |
只能在有需要时使用<small>小型字</small>标签。
|
只能在有需要时使用小型字标签。 |
一段<small>标签的跨度 |
举例,如果要符合{{le|Help:视觉档案标记语言#图说|Help:Visual file markup#Caption|图像说明}}的文字大小,其「small」标签也可以用于
<small style="font-size:87%;">缩减文字大小至原来的87%</small>。 |
举例,如果要符合模板:Le的文字大小,其「small」标签也可以用于缩减文字大小至原来的87%。 |
大型字 |
最好不要使用<big>大型字</big>,除非用于<small>一段<big>小型字</big>当中</small>。
|
最好不要使用大型字,除非用于一段小型字当中。 |
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 {{nowrap}} is probably more suitable.) |
Mr.&nbsp;Smith or 400&nbsp;km/h |
Mr. Smith or 400 km/h |
在文字中实现额外间距,通常最好的方法是使用{{pad}}模板。 |
玛丽{{pad|4.0em}}有只小绵羊。 |
玛丽模板:Pad有只小绵羊。 |
特殊字符[编辑]
Special characters can often be displayed using numeric character references or character entity references. See Character encodings in HTML for more information. For example, À
and À
both render À (A-grave). Percent-encoding can't be used, as it works only in URLs.
变音符号[编辑]
使用字符实体引用的变音符号。
输入内容 | 输出内容 |
---|---|
À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ø Œ Ù Ú Û Ü Ÿ ß à á â ã ä å æ ç è é ê ë ì í î ï ñ ò ó ô õ ö ø œ ù ú û ü ÿ |
À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ø Œ Ù Ú Û Ü Ÿ ß à á â ã ä å æ ç è é ê ë ì í î ï ñ ò ó ô õ ö ø œ ù ú û ü ÿ |
特殊标点符号[编辑]
更多符号,也使用字符实体引用。
输入内容 | 输出内容 |
---|---|
¿ ¡ § ¶
|
¿ ¡ § ¶ |
† ‡ • – —
|
† ‡ • – — |
‹ › « »
|
‹ › « » |
‘ ’ “ ”
|
‘ ’ “ ” |
' "
|
' " |
Escaping punctuation characters[编辑]
使用<pre>
、<nowiki>
及<code>
等标签也可以阻止诸如"[", "{", "&", "}", "]"等符号被判定为Wiki标记。
商业符号[编辑]
使用下列的字符来引用商业符号。
输入内容 | 输出结果 |
---|---|
™ © ®
|
™ © ® |
¢ € ¥ £ ¤
|
¢ € ¥ £ ¤ |
希腊字母[编辑]
使用下列的字符来引用希腊字母。
输入内容 | 输出结果 |
---|---|
α β γ δ ε ζ
|
α β γ δ ε ζ |
Α Β Γ Δ Ε Ζ
|
Α Β Γ Δ Ε Ζ |
η θ ι κ λ μ ν
|
η θ ι κ λ μ ν |
Η Θ Ι Κ Λ Μ Ν
|
Η Θ Ι Κ Λ Μ Ν |
ξ ο π ρ σ ς
|
ξ ο π ρ σ ς |
Ξ Ο Π Ρ Σ
|
Ξ Ο Π Ρ Σ |
τ υ φ χ ψ ω
|
τ υ φ χ ψ ω |
Τ Υ Φ Χ Ψ Ω
|
Τ Υ Φ Χ Ψ Ω |
埃及象形文字[编辑]
WikiHiero是一种软件扩充元件,可以使用模板:Xtag标签来产生埃及象形文字的PNG图片。
举例:
代码 | 效果 |
---|---|
<hiero>P2</hiero> |
<hiero>P2</hiero> |
国际象棋符号[编辑]
举例,「♔」将会产生♔。
上标与下标[编辑]
- 格式手册推荐使用
<sub>
与<sup>
格式,例如x
。本格式应使用于大多数情况。<sub>1</sub>
- 下表所列出的第二种上标与下标方式,不能用于绝大多数内容,这必需仰赖Unicode的支援,并非所有使用者的机器能正确显示。
描述 | 输入内容 | 输出结果 |
---|---|---|
上标 |
x<sup>1</sup> x<sup>2</sup> x<sup>3</sup> 或 x⁰ x¹ x² x³ x⁴ x⁵ x⁶ x⁷ x⁸ x⁹ |
x1 x2 x3 或 x⁰ x¹ x² x³ x⁴ x⁵ x⁶ x⁷ x⁸ x⁹ |
下标 |
x<sub>1</sub> x<sub>2</sub> x<sub>3</sub> 或 x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ |
x1 x2 x3 或 x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ |
合并使用 |
ε<sub>0</sub> = 8.85 × 10<sup>−12</sup> C² / J m 1[[公顷]] = [[1 E+4 m²]] |
ε0 = 8.85 × 10−12 C² / J m |
私人使用区字符以及不可见字符[编辑]
不可见与私人使用区字符,如有可能应尽量避免使用。如果仍然需要使用,应当使用其六进位代码值(如「&#(x)...;」)。这将会使不可见字符变为可见以利手动编辑,并且能够让AWB处理有私人使用区字符的页面。私人使用区字符还应当要加上{{PUA}}模板,以利后续追踪与维护。
数学字符与方程式[编辑]
数学字符[编辑]
- 请参考Wikipedia:数学符号、数学专题与TeX。
输入内容 | 输出结果 |
---|---|
∫ ∑ ∏ √ | ∫ ∑ ∏ √ |
− ± ∞ | − ± ∞ |
≈ ∝ ≡ ≠ | ≈ ∝ ≡ ≠ |
≤ ≥ | ≤ ≥ |
× · ÷ ∂ | × · ÷ ∂ |
′ ″ | ′ ″ |
∇ ‰ ° ∴ ℵ | ∇ ‰ ° ∴ ℵ |
ø | ø |
∈ ∉ ∩ ∪ | ∈ ∉ ∩ ∪ |
⊂ ⊃ ⊆ ⊇ | ⊂ ⊃ ⊆ ⊇ |
¬ ∧ ∨ ∃ ∀ | ¬ ∧ ∨ ∃ ∀ |
⇒ ⇐ ⇓ ⇑ ⇔ | ⇒ ⇐ ⇓ ⇑ ⇔ |
→ ← ↓ ↑ ↔ | → ← ↓ ↑ ↔ |
数学公式[编辑]
- 方程式中的数学字母(如模板:Math)以及运算符号(如
×
)不应使用普通字母,如x
。请参考数学公式的排版。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, or start the input with1=
. 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.
代码 | 效果 |
---|---|
|
|
单一数学方程式中插入空白[编辑]
- 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.
代码 | 效果 |
---|---|
|
|
复杂方程式[编辑]
- 参见Help:数学公式以查阅如何使用
<math>
。 - 显示在一行中的公式应使用半角冒号(:)字符缩进。
代码 | 效果 |
---|---|
|
|
连结与网址[编辑]
维基连结[编辑]
用双方括号来建立一个内部连结([[内部连结]]
),竖线修改连结显示的文字([[连结指向的页面|连结显示的文字]]
)。
连结至其他维基百科条目[编辑]
- 在内部运作中,每个目标页面的首字母会被自动大写,同时空格会用下划线(“_”)表示。(输入下划线的效果会和输入空格完全一样,但这个做法不推荐)
- 因此链接
[[台北车站 (桃园捷运)]]
会指向这个地址:https://zh.wikipedia.org/wiki/台北车站_(桃园捷运)
。- 更多详情请参阅Help:链接。
- 红色链接表示尚未存在的页面;点击进去可以创建这个页面。
- 指向自己页面的链接只会显示为加粗文本。
代码 | 效果 |
---|---|
伦敦没有[[台北车站 (桃园捷运)]]。 |
伦敦没有台北车站 (桃园捷运)。
|
指向本页的链接[[Help:Wiki标记式语言]] |
指向本页的链接Help:Wiki标记式语言会显示为加粗文本。 |
重命名连结[编辑]
- 用于相同目标页面但有不同显示名称的情形。
- 目标页面文字应当放在第一个位置,显示文字则置于第二个位置(以「竖线」为界)。
程序码 | 效果 |
---|---|
纽约也没有[[台北车站 (桃园捷运)|台北站]]。 |
纽约也没有台北站。 |
自动重新命名连结[编辑]
- 在一些情形下,你只要在某个链接的后面打上一个竖线,系统会自动重新命名这个链接。下次你开启编辑方块时,你会看到修改后的新连结。当你预览你的编辑时,在你按下Save 或是再次按下Edit之前,你都不会看到修改后的新连结。 同样的情形,也会套用在链接到同一页的某个段落。
说明 | 程序码 | 效果 |
---|---|---|
自动隐藏括号中的文字 |
[[界 (生物)|]] |
|
自动隐藏英文逗号后的文字(中文维基不常用) | [[Seattle, Washington|]] |
Seattle |
自动隐藏命名空间名称 |
[[Wikipedia:互助客栈|]] |
|
或者同时隐藏 |
[[Wikipedia:Manual of Style (headings)|]] |
|
但无法隐藏章节名称连结 |
[[Wikipedia:格式手册#条目定义句|]] |
[[Wikipedia:格式手册#条目定义句|]] |
连结至条目的章节[编辑]
- 井号后的部分可以连结到条目的特定章节(
[[内部连结#章节名称]]
)。若该章节不存在,则会连结到该条目的顶端。 - 加上竖线,让产生的连结更好看(
[[内部连结#章节名称|内部连结]]
或[[内部连结#章节名称|章节名称]]
)。 - 若欲连结至同一个页面的特定章节,可以直接输入井号(
[[#相同页面的章节名称]]
)。
输入内容 | 输出内容 |
---|---|
[[新朝#外交]]指向条目「新朝」的外交章节 |
新朝#外交指向条目「新朝」的外交章节 |
[[#格式]]连结到目前页面的「格式」章节;[[#格式|格式]]亦同,但不显示井号。 |
|
[[Wikipedia:格式手册#条目定义句|条目定义句]]连结到另一个页面的一个章节。 |
条目定义句连结到另一个页面的一个章节。 |
建立红链[编辑]
输入内容 | 输出内容 |
---|---|
这里有一个[[没人新建的条目]] |
这里有一个没人新建的条目 |
重定向[编辑]
描述 | 输入内容 |
---|---|
重定向至一个页面 |
#REDIRECT [[新朝]] |
重定向至一个章节 |
#REDIRECT [[新朝#外交]] |
连结至其他命名空间[编辑]
- 若连结非条目,方括号里必须包括命名空间,可以使用简称。
输入内容 | 输出内容 |
---|---|
参见[[Wikipedia:格式手册]] |
|
参见[[Wikipedia:格式手册|]] |
参见格式手册 |
参见[[WP:格式手册|]] |
参见格式手册 |
连结至同一条目的不同语言版本(跨语言连结)[编辑]
在维基数据启用后,会透过这个数据库添加跨语言连结。在条目中的跨语言连结应只用于特殊目的,例如某个语言的条目中要特别标明有另外两种语言的名称或条目内容。 |
- 如果要产生至其他语言的对应页面的连结,请使用这个格式:。
[[语言代码:外语页面名称]]
- 建议跨语言连结放在页面内容的最后。
- 跨语言连结不会在内容文本中出现,而是出现在左侧「其他语言」区块底下。
- 注意:上述方法除非有特殊状况,否则已由维基数据取代。如果要在条目或文本内容中建立任何外语条目或内容的内部连结,请见Help:跨语言链接#出现在正文中的连结并理解使用方法。
描述 | 输入内容 |
---|---|
在英语条目「Plankton」建立西班牙语条目「Plancton」的连结。 |
[[es:Plancton]] |
[[fr:Plancton]] [[de:Plankton]] [[ru:Планктон]] [[simple:Plankton]] |
跨Wiki连结[编辑]
- 跨Wiki连结可连结至其他Wiki网站的任何页面。维基项目间连结可连结至其他维基媒体的Wiki网站。
- 请注意跨Wiki连结需使用内部连结,也就是两侧放入半形方括号。
- 请参考跨Wiki地图中所列出的捷径;如果您想要连结的网站不在该列表中,请使用外部连结。
- 也请参考姊妹计划。
描述 | 输入内容 | 输出结果 |
---|---|---|
连结至另一个英语Wiki网站的页面。 下列三种格式将会直接导向http://en.wiktionary.org/wiki/hello网址。 | ||
简单连结 去除前缀字符 将连结命名 |
[[Wiktionary:hello]] [[Wiktionary:hello|]] [[Wiktionary:hello|Hello在英语维基辞典的定义]] |
|
连结至其他语言Wiki网站中的页面。 下列三种格式将会直接导向http://fr.wiktionary.org/wiki/bonjour网址。 | ||
简单连结 去除前缀字符 将连结命名 |
[[Wiktionary:fr:bonjour]] [[Wiktionary:fr:bonjour|]] [[Wiktionary:fr:bonjour|bonjour]] |
分类[编辑]
- 用
[[Category:分类名称]]
可以把页面加到一个分类中,这些连结应该一起放在条目的最末处。 - 若您要在页面中显示一个指向分类页面的连结,在Category前加上一个半形冒号(
[[:Category:分类名称]]
)
描述 | 输入内容 | 输出内容 |
---|---|---|
把条目加到分类中 |
[[Category:维基百科指南]] |
|
连结至一个分类 |
[[:Category:维基百科指南]] |
|
连结至一个分类(用Cat替代Category,可在讨论等情况下使用) |
[[:Cat:维基百科指南]] |
|
连结至一个分类(只显示分类名称) |
[[:Category:维基百科指南|]] |
外部连结[编辑]
- 单个方括号用于定义外部连结。不同于内部连结的竖线,请使用半形空格分开URL和连结显示的名称(
[网址 显示的文字]
)。如果方括号内没有URL,其依然可当作普通符号使用——[像这样]。 - 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 percent encoded. For example, a space must be replaced by
%20
. Encoding can be achieved by:
- Use the link button 文件:Vector toolbar insert link button.png 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:
space | " | ' | , | ; | < | > | ? | [ | ] |
---|---|---|---|---|---|---|---|---|---|
%20 | %22 | %27 | %2c | %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 | 输入内容 | 输出内容 |
---|---|---|
已命名的连结,连结末尾会有一个图示。 |
[http://www.wikipedia.org Wikipedia] |
|
未命名的连结,只在文本中当作脚注使用。 |
[http://www.wikipedia.org] |
|
直接显示网址 使用<nowiki></nowiki>标签避免自动连结 |
http://www.wikipedia.org |
|
没有图示的连结 |
<span class="plainlinks">[http://www.wikipedia.org Wikipedia]</span> |
自动化连结[编辑]
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.
书籍来源[编辑]
- Link to books using their ISBN, which creates a link to 网络书源. 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.
输入内容 | 输出内容 |
---|---|
{{ISBN|022628705X}} |
|
{{ISBN|0-22-628705-X}} |
|
Link to a book using [[Special:BookSources/0670037818|alternative text, such as its title]] |
Link to a book using alternative text, such as its title |
RFC号码[编辑]
What you type | What it looks like |
---|---|
Text mentioning an RFC number anywhere, e.g. RFC 4321. |
Text mentioning an RFC number anywhere, e.g. RFC 4321. |
杂项[编辑]
「截至」模板[编辑]
- The As of template generates phrases like "As of April 2009" or "as of April 2009", and categorize information that will need updating. For an explanation of the parameters see the {{As of}} documentation.
What you type | What it looks like |
---|---|
{{As of|2009|4|df=us}} |
|
{{As of|2009|4|df=us|lc=y}} |
多媒体连结[编辑]
- 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 |
---|---|
[[media:Classical guitar scale.ogg|Sound]] |
直接连结至编辑模式[编辑]
- These create links that directly go to the edit or view source tab. For example, to create links to the edit tab for this page, either of the following works:
描述 | 输入内容 | 输出内容 |
---|---|---|
{{fullurl}} 模块 |
[{{fullurl:Help:Wiki markup|action=edit}} 编辑] |
|
{{Edit}}模块 |
{{edit}} |
部分文字斜体化的连结[编辑]
- Linking to a page with a title containing words that are usually italicized, such as the Hindenburg disaster article.
What you type | What it looks like |
---|---|
[[Hindenburg disaster|''Hindenburg'' disaster]] |
音标注记[编辑]
很多时候我们需要给单词标注发音。这种情况下,Template:IPAc-en和Template:Respell这两个模板会很有用。
代码 | 效果 |
---|---|
'''Konjac''' {{IPAc-en|lang|pron|ˈ|k|oʊ|n|j|æ|k}} |
Konjac 模板:IPAc-en |
'''Konjac''' ({{IPAc-en|lang|pron|ˈ|k|oʊ|n|j|æ|k}} {{respell|KOHN|yak}}) |
Konjac (模板:IPAc-en 模板:Respell) |
''Konjac'' is pronounced {{IPAc-en|ˈ|k|oʊ|n|j|æ|k}} in English. |
Konjac is pronounced 模板:IPAc-en in English. |
关于更详细的要求,请参阅Wikipedia:格式手册/音标。
音乐符号[编辑]
音乐符号可以使用模板:Xtag扩展标签予以增加。举例:
代码 | 效果 |
---|---|
|
<score>\relative c' { fis d fis a d f e d c cis d e a g f ees }</score> |
图像[编辑]
只有上传至维基百科或维基共享资源的图像才能够使用。如果要上传图像,自行拍摄的图像请使用维基共享资源的上传精灵;如果要上传的图像有任何著作权问题,请使用上传精灵。您可以在图像列表当中找到已经上传的图像。
有关维基百科内的图像方针,请见档案使用守则。
有关图像的进一步帮助,包括一些更通用的功能,请参阅图片教程和扩展图像语法。
程序码 | 效果 | 注解 | |||
---|---|---|---|---|---|
The image name, the word thumb then the caption:
[[File:wiki.png|thumb|Wikipedia logo]] |
The image name, the word thumb then the caption : 模板:Clear |
| |||
A picture: [[File:wiki.png]] |
A picture: 文件:Wiki.png |
| |||
With alternative text:
[[File:wiki.png|alt=Puzzle globe logo]] |
With alternative text: |
Alternative text, used when the image is unavailable or when the image is loaded in a text-only browser, or when spoken aloud, is strongly encouraged. See Alternative text for images for help on choosing it. | |||
With link:
[[File:wiki.png|link=Wikipedia]] |
With link: |
| |||
Forced to the centre of the page
using the ''frame'' tag (attribute), a ''centre'' tag and a caption:
[[File:wiki.png|frame|centre|alt=Puzzle globe|Wikipedia logo]]> |
Forced to the centre of the page using the frame tag (attribute), a centre tag and a caption: 模板:Clear |
| |||
Forced to the left side of the page
using the ''thumb'' attribute, the ''left'' attribute and a caption:
[[File:wiki.png|thumb|left|alt=Puzzle globe|Wikipedia logo]] |
Forced to the left side of the page using the thumb attribute, the left attribute and a caption: 模板:Clear |
| |||
Forced to the right side of the page
''without'' a caption:
[[File:wiki.png|right|Wikipedia encyclopedia]] |
Forced to the right side of the page without a caption: |
| |||
A picture resized to 50 pixels...
[[File:wiki.png|50 px|Wikipedia encyclopedia]] |
A picture resized to 50 pixels... |
The picture tutorial explains more options.
| |||
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;">
[[File:wiki.png|50 px|Wikipedia encyclopedia]][[File:wiki.png|50 px]] </div> |
Example: |
| |||
Example:
{| align=right
|-
|
[[File:wiki.png|50 px]]
|-
|
[[File:wiki.png|50 px]]
|-
|
[[File:wiki.png|50 px]]
|} |
Example: |
|
表格[编辑]
建立表格有两种方式:
- 使用特殊的Wiki标记式语言(参见Help:表格)。
- 使用HTML元素:
<table>
、<tr>
、<td>
或<th>
。
请参考表格的适用时机。
分栏显示[编辑]
使用模板{{colbegin}}和{{colend}}将内容分栏显示。
参考文献与引用来源[编辑]
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 |
---|---|
模板:Nowrap | <ref >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 (only if url= is included)
|
A complete reference tag | <ref > {{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 />
|
Citation needed | {{Citation needed|模板:Tls}}
|
模板与包含嵌入页面[编辑]
模板举例:{{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 unintentional categorization. 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 |
.
输入内容 | 输出内容 |
---|---|
{{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: Go to this page to see the H:title template itself: {{H:title}} |
讨论页与计划页面[编辑]
These are likely to be helpful on talk and project pages.
签名[编辑]
- The tilde character (~) is used when signing a comment on 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. |
|
20:35, 21 11月 2024 (UTC) |
连结至某个页面的旧有修订版本、修订差异以及特定历史页面[编辑]
- The 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.
程序码 | 效果 |
---|---|
|
程序码 | 效果 |
---|---|
|
- If the diff intended to be shown is between an immediately previous revision, the first parameter can be dropped.
程序码 | 效果 |
---|---|
|
- 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).
程序码 | 效果 |
---|---|
|
链入页面和链入页面变更纪录[编辑]
- 以下代码可以转到相应页面查看链入页面和链入页面变更纪录,如查看Help:Wiki标记式语言的相关纪录:
代码 | 效果 |
---|---|
|
|
|
使用者编辑[编辑]
- Link to a user's contributions page.
描述 | 输入内容 | 输出内容 | 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 |
将文字上色或高亮化[编辑]
- 使用{{Color}}及{{Font color}}模板:
程序码 | 效果 |
---|---|
|
我将会在这个句子模板:Color改变颜色。 |
|
这是如何模板:Font color的方法。 |
范例文字[编辑]
The {{xt}}
family of templates can be used on help pages and user pages to highlight example text.
What you type | What you get |
---|---|
This is an {{xt|A correct example}} for comparison {{tick}} | This is an 模板:Xt for comparison 模板:Tick |
this is an {{!xt|An incorrect example}} for example {{cross}} | this is an 模板:!xt for example 模板:Cross |
this is an {{mxt|In monospace}} for comparison | this is an 模板:Mxt for comparison |
this is an {{!mxt|In monospace}} for comparison | this is an 模板:!mxt for comparison |
this is an {{bxt|in bold}} for comparison | this is an 模板:Bxt for comparison |
this is an {{!bxt|In bold}} for comparison | this is an 模板:!bxt for comparison |
Show deleted or inserted text[编辑]
- When editing your own previous remarks in talk pages, it is sometimes appropriate to mark up deleted or inserted content:
- It is best to indicate deleted content using the strike-through markup
<s>...</s>
. - It is best to indicate inserted content using the underline markup
<u>...</u>
.
- It is best to indicate deleted content using the strike-through markup
- When editing regular Wikipedia articles, just make your changes, and do not mark them up in any special way. However, when the article itself discusses deleted or inserted content, such as an amendment to a statute:
- It is best to indicate deleted content using the strike-through markup
<del>...</del>
. - It is best to indicate inserted content using the underline markup
<ins>...</ins>
.
- It is best to indicate deleted content using the strike-through markup
Note: <s></s>
and <u></u>
(speced in HTML 3 & 4) are considerably more popular than <del></del>
and <ins></ins>
(speced in HTML 5) on Wikipedia.
What you type | What it looks like |
---|---|
|
You can |
Alternative markup:
|
You can |
Strike through[编辑]
This is also possible with the {{strike}}
} template.
What you type | What you get |
---|---|
This is {{strike|A misplaced bit of text}} for comparison | This is 模板:Strike for comparison |
==
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: &rarr;
|
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: → |
无Wiki模式[编辑]
In order for the software to interpret wiki markup, its parser first scans the page. When it sees its nowiki tags
<nowiki>...</nowiki>
(escapes all contained wiki markup), and<nowiki />
(escapes the interpretations it is designed to "break"),
it escapes its wikicode, so editors can document its markup using its markup.
Article editors can normalize the font of characters trailing [[...]]outside
a wikilink, which would otherwise adhere to the wikilink font. They can also add line-spacing in the wikitext. Template editors: tag <nowiki>
works only on its source page, not the target; also {{#tag:nowiki | content}}
, although it wraps that content in nowiki tags, it also does a pre-save transform on that content, which is entirely at odds with the intended purpose of nowiki for templates, subst, signatures, and the pipe-trick.
The two kinds of nowiki operate in different ways to target content, but they both remove meaning (subtract rendering) of wiki markup, then disappear into the background font. Nowiki does nothing toward rendering, but it can add newlines to wikitext (for readability), just like the HTML comment (the preferred method) can. Unlike it does for wiki markup, nowiki does not remove the meaning of character entities, either HTML or MediaWiki special characters.
There is only one meaning for what <nowiki>...</nowiki>
contains, so it needs few examples; but the singular <nowiki />
tag "contains" many linkage structures, where it is expected between bracketing-pair characters or in the keyword area. So this section has many examples and few mis-examples.
For example, only at the beginning of a line (bol of wikitext, bol in a transclusion, or beginning of a table cell), do 模板:Code, 模板:Code, 模板:Code or 模板:Code mean something.
代码 | 效果 |
---|---|
# Ordered list |
|
<nowiki /># Ordered list |
模板:Crlf2 # Ordered list |
A [[micro-]]second. |
A micro-second. |
A [[micro-]]<nowiki />second. |
A micro-second. |
a<nowiki> b</nowiki> |
a b |
'<nowiki />'Italics' markup'<nowiki />' |
''Italics' markup'' |
<nowiki>[[Example]]</nowiki> |
[[Example]] |
<nowiki><!-- revealed --></nowiki> |
<!-- revealed --> |
The rest of the section consists of simple, live examples showing how a single nowiki tag escapes entire linkage structures, beyond [[ wikilink ]] and {{ template }}:
- [[ fullpagename | label ]]
- {{ pagename | parameter }}
- [[fullpagename | {{ pagename }} ]]
- {{ pagename | [[ fullpagename ]] }}
- {{ pagename | {{ pagename }} }}
Unless you use the two "balanced" nowiki tags, troubleshooting strip marker errors and template parameter-handling inconsistencies is a risk. Also, a rendering error may arise when two [[...]] square brackets are on the same line, or two {{...}} curly brackets are in the same section, but only when the two have the nowiki markup placed inconsistently.
Displaying wikilinks[编辑]
(These are all live examples.)
[[ wp:pagename | page name ]] [<nowiki />[ wp:pagename | page name ]] [[<nowiki /> wp:pagename | page name ]] [[ wp:pagename <nowiki />| page name ]] [[ wp:pagename | page name ]<nowiki />]
<poem>
- page name
- [[ wp:pagename | page name ]]
- [[ wp:pagename | page name ]]
- [[ wp:pagename | page name ]]
- [[wp:pagename | page name ]]
</poem>
For nested structures, escaping an inner structure escapes its outer structure too.
[[ wp: {{ 1x | pagename }} ]] [[ wp: {<nowiki />{ 1x | pagename }} ]] [[ wp: {{<nowiki /> 1x | pagename }} ]] [[ wp: {{ 1x <nowiki />| pagename }} ]]
<poem>
- [[ wp: 模板:1x ]]
- [[ wp: {{ 1x | pagename }} ]]
- [[ wp: {{ 1x | pagename }} ]]
- [[ wp: {{ 1x | pagename }} ]]
</poem>
For two, first pipes, two nowiki tags are required:
[[ wp: pagename | {{ 1x | label }} ]] [[ wp: pagename <nowiki />| {{ 1x <nowiki />| label }} ]] <nowiki>[[ wp: pagename | {{ 1x | label }} ]] </nowiki>
<poem>
- [[wp: pagename | 模板:1x ]]
- [[ wp: pagename | {{ 1x | label }} ]]
- [[ wp: pagename | {{ 1x | label }} ]]
</poem>
Displaying template calls[编辑]
For templates, put nowiki before the first pipe. If a parameter has a wikilink, put it in that, an inmost position.
{<nowiki />{ val | u=> [[ms]] | 49082 }} {{<nowiki /> val | u=> [[ms]] | 49082 }} {{ val <nowiki />| u=> [[ms]] | 49082 }} {{ val | u= > [[ms]] | 49082 }<nowiki />} {{ val | u= > [[ ms ]<nowiki />] | 49082 }}
<poem>
- {{ val | u=> ms | 49082 }}
- {{ val | u= > ms | 49082 }}
- {{ val | u=> ms | 49082 }}
- {{ val | u=> ms | 49082 }}
- {{ val | u= > [[ ms ]] | 49082 }} 模板:OK
</poem>
显示魔术字[编辑]
For input parameters, {{{1}}}, {{{2}}}, just write them out, unless they have a default (which goes behind their pipe): {{<nowiki />{1|default}}} → {{{1|default}}}
For a parser function nowiki goes between bracketing-pair characters, or anywhere before the : colon.
{{ #ifeq: inYes | inYes | outYes | outNo }} {<nowiki />{ #ifeq: inYes | inYes | outYes | outNo }} {{<nowiki /> #ifeq: inYes | inYes | outYes | outNo }} {{ #ifeq<nowiki />: inYes | inYes | outYes | outNo }} {{ #ifeq: inYes | inYes | outYes | outNo }<nowiki />}
<poem>
- outYes
- {{ #ifeq: inYes | inYes | outYes | outNo }}
- {{ #ifeq: inYes | inYes | outYes | outNo }}
- {{ #ifeq: inYes | inYes | outYes | outNo }}
- {{ #ifeq: inYes | inYes | outYes | outNo }}
</poem>
Behavioral switches expect the tag anywhere:
1. __HIDDENCAT__ 2. __HIDDENCAT<nowiki />__
- 1. 模板:Break
- 2. __HIDDENCAT__
Displaying tags[编辑]
<tags>
do not display; they are just markup. If you want them to, insert <nowiki />
after an 模板:Code opening angle bracket; it goes only in the very front. Opening tags and closing tags must be treated separately.
<span style=color:blue> Blue </span> <<nowiki />span style=color:blue> Blue <<nowiki />/span> <section end=la<nowiki />bel />
<poem>
- Blue
- <span style=color:blue> Blue </span>
- bel /> 模板:Cross
</poem>
Use template {{tag}} instead of nowiki tags to display parser tags:
Character entities, nowiki cannot escape.
To escape HTML or special character entities, replace &
with &
.
For example, &lt;
→ <
To display a nowiki tag, you can (1) use {{tag}}, (2) replace the < left angle bracket with its HTML character entity, or (3) nest nowiki tags in each other:
{{ tag | nowiki }} <code>< nowiki>...</ nowiki ></code> <code><<nowiki />nowiki>...<<nowiki />/ nowiki ></code>
<poem>
< nowiki>...</ nowiki >
< nowiki>...</ nowiki >
< nowiki>...</ nowiki >
</poem>
{{ tag | nowiki | s }} <code>< nowiki /></code> <code><<nowiki /> nowiki /></code> <code><nowiki>< nowiki /></nowiki></code>
<poem>
< nowiki />
< nowiki />
< nowiki />
< nowiki />
</poem>
Nowiki tags do not otherwise nest, so it is the second and fourth that displays:
1<nowiki>2<nowiki>3</nowiki>4</nowiki> <nowiki>{{!}}<nowiki></nowiki>{{!}}</nowiki>
<poem>
</poem>
These simply scan from left to right. The paired tags cannot overlap, because the very first pair-match nullifies any intervening tags inside. Unbalanced tags always display.
Nowiki tags do not display table markup, use <pre>...</pre>
.
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 >
- Scroll bar:
<pre >
Alternatively, consider using {{pre2}} template or 模板:Xtag.
隐藏文字(注解)[编辑]
It's uncommon模板:Spaced ndashbut on occasion acceptable for notes to other editors模板:Spaced ndashto 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 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 模板:Nowrap operates similarly to the comment 模板:Nowrap. The main difference is that the template version can be nested, while attempting to nest HTML comments produces odd results.
变量[编辑]
原始码 | 效果 | 注解 |
---|---|---|
{{CURRENTWEEK}} | 47 | |
{{CURRENTDOW}} | 4 |
星期一 = 1、星期二 = 2,依此类推,但星期日 = 0 |
{{CURRENTMONTH}} | 11 | |
{{CURRENTMONTHNAME}} | 11月 | |
{{CURRENTMONTHNAMEGEN}} | 11月 | |
{{CURRENTDAY}} | 21 | |
{{CURRENTDAYNAME}} | 星期四 | |
{{CURRENTYEAR}} | 2024 | |
{{CURRENTTIME}} | 20:35 | |
{{NUMBEROFARTICLES}} | 3,079 | |
{{NUMBEROFPAGES}} | 7,668 | |
{{NUMBEROFUSERS}} | 23 | |
{{PAGENAME}} | Wiki标记式语言 | |
{{NAMESPACE}} | 帮助 | |
{{REVISIONID}} | 23974 | |
{{REVISIONUSER}} | 忆兰居士 | |
{{localurl:pagename}} | /Pagename | |
{{localurl:Wikipedia:Sandbox|action=edit}} | https://en.wikipedia.org/wiki/Sandbox?action=edit | |
{{fullurl:pagename}} | https://wiki.mindseed.cn/Pagename | |
{{fullurl:pagename|query_string}} | https://wiki.mindseed.cn/index.php?title=Pagename&query_string | |
{{SERVER}} | https://wiki.mindseed.cn | |
{{ns:1}} | 讨论 |
{{ns:index}},如:{{ns:1}} → 名字空间全名 |
{{SITENAME}} | 心百科 |
模板:Tlf 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 is the genitive (possessive) grammatical form of the month name, as used in some languages but not in English; 模板:Tlf 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[编辑]
许多HTML标签可用于Wiki标记式语言。You can check your HTML by using markup validation.
参见[编辑]
模板:Help desk See the 'Coding wiki markup' section of the Help navigation navbox below for additional links.
- Help:Magic links: magic links are automatic links for certain unique identifiers that require no markup.
- Wikipedia:Extended image syntax: advanced visual file markup.
- Help:A quick guide to templates: an introduction to templates.
- Help:Substitution: substitution is an alternative way of including templates than transclusion
- Help:Score: how to render musical scores.
- Help:Displaying a formula: displaying mathematical formulae.