Help:Wikitext examples/zh

This page is a translated version of the page Help:Wikitext examples and the translation is 22% complete.
PD 注意:當您編輯本頁面時,即同意以CC0協議授權您的貢獻。您可以在公有領域帮助页面找到更多信息。 PD
Rendering Wikitext
Emphasize (italics), strongly (bold), very strongly (bold italics).

(These are double and triple apostrophes, not double quotes.)

Note: this can also be applied to links (e.g., Wikipedia).

''Emphasize'', '''strongly''',
'''''very strongly'''''.

''[[Wikipedia]]''
The use of italic and bold fonts is beneficial in mathematical calculations where specific font styles are needed instead of emphasis.
F = ma

(Most people disregard the fact that these two approaches differ in a way that is not particularly significant for graphical browsers.) However, it can have a significant impact on those who are blind.

The use of <i>italic</i> and <b>bold</b> fonts is beneficial in mathematical calculations where specific font styles are needed instead of emphasis.
: <b>F</b> = <i>m</i><b>a</b>
You can write in small caps
You can write <span style="font-variant:small-caps">in small caps</span>
The typewriter font that is occasionally used for technical terms and computer code.
The typewriter font that is occasionally used for <kbd>technical terms</kbd> and <code>computer code</code>.
For captions, you can use small text.
For captions, you can use <small>small text</small>.

Deleted materials can be striked out and new materials can be underlined.

You can also denote deleted material and inserted material with the respective tags, preserving their semantic meaning, rather than relying solely on visual cues like strikethrough and underline.

  • Editing regular articles can be done directly without using special markup to indicate deletions or insertions.
  • Markup can be used to indicate deleted or inserted material when revising previous remarks on talk pages.
Deleted materials can be <s>striked out</s> and new materials can be <u>underlined</u>.

You can also denote <del>deleted material</del> and <ins>inserted material</ins> with the respective tags, preserving their semantic meaning, rather than relying solely on visual cues like strikethrough and underline.
Subscript: m2

Superscript: m2 or m²

Many browsers find it simpler to format lines containing the HTML entity &sup2; (²) rather than using the 2 HTML tag for representing superscripted text.

ε0 = 8.85 × 10−12 C² / J m.

1 hectare = 1 E4 m²

Subscript: m<sub>2</sub><br />
Superscript: m<sup>2</sup> or m&sup2;

&epsilon;<sub>0</sub> =
8.85 &times; 10<sup>&minus;12</sup>
C&sup2; / J m.
<br /><br />
1 [[hectare]] = [[1 E4 m&sup2;]]


Organizing your writing

参见:​Help:Images
渲染 维基文本

Drafting sections and subsections 以标题划线开启一个章节

The top-level heading like the page title is indicated by a single equal (=) sign.
一个章节
一个子章节
另一个孙章节
  • Avoid using first-level headings (=); rather, begin with a second-level heading (==).
  • 避免跳级。举个例子,不要从第二级跳到第四级。
  • 如果一篇文章有四个或四个以上的部分,一个table of contents 目录将会自动生成。
  • Sort the subsections in an appropriate order. When listing countries, for instance, sort them alphabetically as opposed to, say, according to their respective populations inside the OECD or in any other haphazardous order.
  • Use HTML heading tags and close headings without slashes, if you wish to keep them out of the TOC. 例如:
    <h4>Subsection with heading too low level to be in the TOC<h4>
    
== 章节 ==

=== 一个子章节 ===

=== 另一个孙章节 ===
Newline:
  • Adding a new line has no effect.

这是一行文本。 这依然是同一段落的一部分。

  • An empty line starts a new paragraph or ends a list or indented part. The ‎<p> tag can disable a paragraph until ‎</p> or the end of the section.

这是一个段落。

This is a continuation of the paragraph. But it appears after an empty line due to the ‎<p> and ‎</p> tags.

这是一行文本。

This is another line appearing as a second new paragraph instead of a third paragraph due to the ‎<div> and ‎</div> tags.

  • In a list, a newline is used to separate individual items and subitems, enhancing the visual structure and readability of the list content in MediaWiki syntax. See Help:List for examples.
这是一行文本。
This is still part of the same paragraph.

This is a paragraph.<p>This is a continuation of the paragraph. But it appears after an empty line due to the &lt;p> and &lt;/p> tags.</p>

这是一行文本。<div>This is another line appearing as a second new paragraph instead of a third paragraph due to the &lt;div> and &lt;/div> tags.</div>

Lines can be broken
without beginning another paragraph.

  • Kindly don't overuse this.
  • Don't begin a link , italics or bold on one line and end it on the next; instead, close markup per line.
Lines can be broken <br/> without beginning another paragraph.
无序列表
  • Start a line with asterisks (*) to create the first item in an unordered list.
    • Use two asterisks for a sub-item.
      • Increase the number of asterisks for deeper levels.
  • Each line break signifies a new item in the list.

A line starting without a star marks the end of the list.

  • You can start over with a new list

Now you are ready to create well-structured unordered lists.

* Start a line with asterisks (<code>*</code>) to create the first item in an unordered list.
** Use two asterisks for a sub-item.
*** Increase the number of asterisks for deeper levels.
* Each line break signifies a new item in the list.
A line starting without a star marks the end of the list.
* You can start over with a new list

Now you are ready to create well-structured unordered lists.
有序列表
  1. Use a hashtag (#) at the beginning of each line to signify the order.
    1. Use two hashtags (##) for a sub-item.
    2. Continue numbering to maintain the sequence and logical flow of information.
  2. Add a new line between each item for improved readability.

A line starting without a hashtag marks the end of the list.

  1. An ordered list starts with 1.
  2. Then 2, etc.
# Use a hashtag (<code>#</code>) at the beginning of each line to signify the order.
## Use two hashtags (<code>##</code>) for a sub-item.
## Continue numbering to maintain the sequence and logical flow of information.
# Add a new line between each item for improved readability.
A line starting without a hashtag marks the end of the list.
# An ordered list starts with 1.
# Then 2, etc.
混合列表
  • This mixed list begins with an unordered list (*).
    1. To create a subitem of an ordered list under an unordered list use an asterisk and a hashtag (*#).
      • To create a deeper sub-item of an unordered list within an ordered list, add another asterisk (*#*).
      • You can also break
        lines in a list.
* This mixed list begins with an unordered list (<code>*</code>).
*# To create a subitem of an ordered list under an unordered list use an asterisk and a hashtag (<code>*#</code>).
*#* To create a deeper sub-item of an unordered list within an ordered list, add another asterisk (<code>*#*</code>).
*#* You can also break <br/> lines in a list.
Definition Lists

A definition list consists of a series of term-definition pairs.

  • Use a semicolon (;) to indicate the start of a term.
  • Place the term immediately after the semicolon.
  • Use a colon (:) to introduce the definition associated with the term.
  • Place the definition on the line following the colon.
Wiki
A wiki (/ˈwɪki/ ⓘ WI-kee) is a form of online hypertext publication that is collaboratively edited and managed by its own audience directly through a web browser. See w:Wiki.
网络浏览器
网络浏览器是一个访问网站的应用程序。 See w:Web browser

Signifying one item per line is most suitable, rather than adding a new line before the colon (:).

; Wiki
: A wiki (/ˈwɪki/ ⓘ WI-kee) is a form of online hypertext publication that is collaboratively edited and managed by its own audience directly through a web browser. <span lang="en" dir="ltr" class="mw-content-ltr">See [[w:Wiki]].</span>
; Web Browser
: A web browser is an application for accessing websites. <span lang="en" dir="ltr" class="mw-content-ltr">See [[w:Web browser]]</span>
缩进

A paragraph is indented when a colon (:) is specified at the beginning of a line, as explained in Definition Lists .

An indented line.

A new line starts a new non-indented paragraph.

  • This is frequently utilized for discussing on talk pages .
: An indented line.
A new line starts a new non-indented paragraph.
引用块

A blockquote style is used to highlight a specific section of text from an external source or to distinguish it from the surrounding content.

This is a blockquote. It is used to highlight quoted text or separate specific content.

<blockquote>
This is a blockquote. It is used to highlight quoted text or separate specific content.
</blockquote>
水平分割线

The horizontal dividing line on a wiki page is represented by four or more consecutive hyphens (----), enhancing visual organization between sections.

Text above


Text below

Text above
----
Text below


创建链接

主页面: Help:Link

You will often want to make clickable links to other pages.

Rendering Wikitext
Basics

You are reading the 技术文档 .

You are reading the {{ll|documentation}}.
Basics + Text formatting

Links can be italicized e.g.:

MediaWiki

''[[MediaWiki]]''
内部维基链接

These link to another wiki that covers related or similar topics.

This interwiki link points to w:Documentation on Wikipedia.

Its Esperanto word equivalent is eo:Dokumentaro.

This interwiki link points to [[w:Documentation]] on Wikipedia.

Its Esperanto word equivalent is [[:eo:Dokumentaro]].
Links to sections

You can link to a specific section of an existing page by adding a pound (#) and section title after specifying the page name.

Help:Special pages#Editing Special namespace pages

If no such section exists then the link points to the beginning of the page. If a page has multiple sections with the same name, specifying the rank of the section with a number at the end. (e.g., if there are three sections titled "Section title" and you want to link to the third, use [[#Section title 3]]).


See Help:Editing FAQ .

[[Help:Special pages#Editing Special namespace pages|Help:Special pages]]
Piped links

Create a link label using a pipe symbol (|):

The above produces About links, linked to the article Help:Link.

 * [[Help:Link|About links]]
Using a blank link label will automatically fill in an appropriate link label. I.e. [[Kingdom (biology)|]] will be replaced with [[Kingdom (biology)|Kingdom]]
* <span lang="en" dir="ltr" class="mw-content-ltr">Parentheses:</span> [[kingdom (biology)|]].
* <span lang="en" dir="ltr" class="mw-content-ltr">Colon:</span> [[Help:Pipe|]].

指向不存在页面的链接

当一个链接被指向不存在的页面时,会显示为红色(就像这个页面

To create the page, you can click on the link. See Help:创建新页面 (and the naming conventions of your project, if there are).

A link to a page which does not exist (like [[Foo|this one]]) is colored in red.
Redirects

You can create a redirect by adding the wikitext at the beginning of the page. See Help:Redirect .

#REDIRECT [[United States of America]]
#REDIRECT [[United States of America]]
Magic links

Magic links enable users to generate links automatically by typing specific keywords.

These are deprecated and generally should not be used.

* ISBN 0131103629
* RFC 234
Media: links

Media links are used to reference a page containing media files. They are accessed through the Media namespace.

Audio

[[media:Test.ogg|Audio]]
Category links

Category links direct users to a specific category page (without categorizing the page into that category).

To achieve this, a syntax similar to that of links is used, but with a colon (:) added before the namespace.

Category:Documentation

[[:Category:Documentation]]
Special pages

Special pages are created by the wiki software. They are accessed through the Special namespace.

You can create links to special pages like "What links here" using the following format:

Special:Whatlinkshere/Help:Editing

See Help:特殊页面 for other special pages.

[[Special:Whatlinkshere/Help:Editing]]
Links to previous revisions of a page, differences (diffs), and particular history pages

To link to an old revision, diff, or particular history pages, avoid using the standard wiki-link syntax like [[page]]. Instead, utilize the external link function or copy and paste the provided URLs directly.

Linking to previous revisions of a pageTo share an old page version of a wiki, copy the URL from the page's history and paste it where you want to share it.

https://www.mediawiki.org/w/index.php?title=Help:Cite&oldid=6364084

You can also use Special:PermaLink to do this, i.e Special:PermaLink/6364084

Linking to Diffs:To link to page differences between two revisions, copy and paste the specific URL of the page containing the diff of the compared pages.

https://www.mediawiki.org/w/index.php?title=Help%3ACite&diff=6364333&oldid=6364084

You can also use Special:Diff to do this, i.e Special:Diff/6364333/6364084

Linking to a Specific Page from Edit HistoryNavigate to the edit history and select the "(older)" or "(earliest)" buttons to reach a particular page history, then copy the URL and paste it where you want to share it.

https://www.mediawiki.org/w/index.php?title=Help:Cite&action=history&offset=20170210105218%7C2391706&limit=100

https://www.mediawiki.org/w/index.php?title=Help:Cite&oldid=6364084

https://www.mediawiki.org/w/index.php?title=Help%3ACite&diff=6364333&oldid=6364084

https://www.mediawiki.org/w/index.php?title=Help:Cite&action=history&offset=20170210105218%7C2391706&limit=100


Displaying text as typed

A few different formatting methods will ensure the Wiki shows your text exactly as you type it.

渲染 维基文本

The nowiki tag prevents [[Wiki]] ''markup'' from rendering. It adjusts text by eliminating newlines and multiple spaces. It still processes special characters: →

<nowiki>
The nowiki tag prevents 
[[Wiki]] ''markup'' from rendering.
It adjusts text by
eliminating
newlines and multiple
spaces.
It still processes special
characters: &rarr;
</nowiki>
The pre tag bypasses [[Wiki]]
 ''markup''.
It also maintains     text
 format.
It still recognizes special
characters: →
<pre>
The pre tag bypasses [[Wiki]]
 ''markup''.
It also maintains     text
 format.
It still recognizes special
characters: &rarr;
</pre>

Leading spaces offer another method to keep formatting.

Inserting a space at the
start of each
line keeps the text
as is. It still
processes Wiki
markup and special
characters: →
Leading spaces offer another method to keep formatting.
 Inserting a space at the
 start of each
 line keeps the text
 as is. It still
 processes [[Wiki]]
 ''markup'' and special
 characters: &rarr;

显示代码

If the syntax highlighting extension is available, you can show source code similarly to the HTML ‎<pre> tag, but with advanced text editor-like syntax highlighting. 查看受支持的语言列表 http://pygments.org/languages/ Here's an example for displaying C# code:

<syntaxhighlight lang="csharp">
// Hello World in Microsoft C# ("C-Sharp").

using System;

class HelloWorld
{
    public static int Main(String[] args)
    {
        Console.WriteLine("Hello, World!");
        return 0;
    }
}
</syntaxhighlight>

Renders as:

// Hello World in Microsoft C# ("C-Sharp").

using System;

class HelloWorld
{
    public static int Main(String[] args)
    {
        Console.WriteLine("Hello, World!");
        return 0;
    }
}

Using images, tables, video, and sounds

为了获取更多详细指导,请查看:

Once you upload a file, enter its filename, highlight it, and click the "embedded image" button on the edit toolbar. This will generate the embedding syntax:

[[Image:filename.png]]

渲染 维基文本

一张附有替代文本(用于无障碍阅读)的图片   附有边框和说明的图片:

 
这是维基的标志
一张附有替代文本(用于无障碍阅读)的图片
[[Image:Wiki.png|这是维基的标志]]
Image with frame and caption:
[[Image:Wiki.png|frame|This is Wiki's logo]]

Link to MediaWiki's image page: Image:Wiki.png

Direct link to the image: Media:Wiki.png

Link to MediaWiki's image page:
[[:Image:Wiki.png]]

Direct link to the image:
[[Media:Wiki.png]]

The media: namespace tag can be used to link directly to sounds or videos: A sound file

The '''media:''' namespace tag can be used to link directly to sounds or videos:
[[media:Classical guitar scale.ogg|A sound file]]
Include a spoken version of text in a template ({{Listen }}):
  Flow, my tears (1.41 MB, help | download | file info)
Include a spoken version of text in a template:
{{listen
 |title    = Flow, my tears
 |filename = Flow, my tears.ogg
 |filesize = 1.41 MB
}}
Text in a bordered box
|<center><span style="border:5px double black">'''Text in a bordered box'''</span></center>
|
This is
a table
{| style="margin: auto; border: 10px solid black; border-spacing: 5px;"
|-
! style="padding: 10px;" | This 
! style="padding: 10px;" | is 
|- 
| style="padding: 10px;" | a 
| style="padding: 10px;" | table 
|}

Galleries

参见:​w:WP:Gallery tag

Images can be organized into galleries using the ‎<gallery> tag, like this:

Mathematical formula

To format mathematical formula, you can useTeX markup.

Rendering Wikitext
n=0xnn!
<math>\sum_{n=0}^\infty \frac{x^n}{n!}</math>


Templates

主页面: Help:Template

Templates are snippets of Wiki markup that can be automatically copied ("transcluded") into a page. You can add them by placing the template's name inside {{double braces}}. To transclude pages from other namespaces, use {{:colon and double braces}}. Some templates accept parameters, separated by the pipe character.

Rendering Wikitext

This is a short demo text from the Wikitext examples/transclusion demo sub-page.

{{Help:Wikitext examples/transclusion demo}}

This template uses takes one parameter and returns it twice:

Hello WorldHello World

This template uses takes one parameter and returns it twice:
{{2x|Hello World}}

See also