Help:Editing

From ArchWiki
(Redirected from Help:Editing (正體中文))

ArchWiki is powered by MediaWiki, a free software wiki package written in PHP, originally designed for use on Wikipedia. More in-depth help can be found at Help:Contents on MediaWiki and Help:Contents on Wikipedia.

This is a short tutorial about editing the ArchWiki. Before editing or creating pages, users are encouraged to familiarize themselves with the general tone, layout, and style of existing articles. An effort should be made to maintain a level of consistency throughout the wiki. See ArchWiki:Contributing, Help:Style and Help:Reading for an overview of the common conventions. To experiment with editing, please use the sandbox. For an overview of wiki markup, see Help:Cheatsheet.

Creating an account

Before registering, make yourself familiar with our Code of conduct. To be able to edit ArchWiki articles, you must create an ArchWiki account and confirm the e-mail address used for registration. Answering the captcha question requires an up-to-date Arch Linux environment: non-Arch users are very welcome to contribute to the wiki, and in order to answer the question they can for example boot into a live Arch system with the latest installation image, use pacman-staticAUR (precompiled binaries are available) or simply use a container image utilizing tools such as Docker.

Once you have an account, log in from Special:UserLogin.

Editing

To begin editing a page, click the Edit source tab at the top of the page. Alternatively, users may edit a specific section of an article by clicking the edit source link to the right of the section heading. The Editing page will be displayed, which consists of the following elements:

  • Edit toolbar (optional)
  • Edit box
  • Edit summary box
  • Save changes or Save page, Show preview, Show changes, and Cancel links

The edit box will contain the wikitext (the editable source code from which the server produces the web page) for the current revision of the page or section. To perform an edit:

  1. Modify the wikitext as needed (see #Formatting below for details).
  2. Explain the edit in the Summary box (e.g. "fixed typo" or "added info on xyz").
    Note: All edits should be accompanied by a descriptive summary to facilitate reviewing from other users. See ArchWiki:Contributing#The 3 fundamental rules for more information.
  3. Use the Show preview button to facilitate proofreading and verify formatting before saving.
  4. Mark the edit as minor by checking the This is a minor edit box if the edit is superficial and indisputable.
  5. Save changes by clicking Save changes. If unsatisfied, click Cancel instead (or repeat the process until satisfied).
Note: Articles should not be signed because they are shared works; one editor should not be singled out above others.

Reverting edits

If a page was edited incorrectly, the following procedures describe how to revert an article to a previous version. To revert a single edit:

  1. Click the View history tab at the top of the page to be modified (beside the Edit source tab). A list of revisions is displayed.
  2. Click the undo link to the right of the unwanted edit. An edit preview is displayed, showing the current revision on the left and the text to be saved on the right.
  3. Write the reason why you are undoing this edit to the edit summary field.
  4. If satisfied, click the Save changes button at the bottom of the page.

The wiki page should now be back in its original state.

Occasionally, it is necessary to revert several last edits at once. To revert an article to a previous version:

  1. Click the View history tab at the top of the page to be modified (beside the Edit source tab). A list of revisions is displayed.
  2. View the desired revision (i.e. the last good version) by clicking on the appropriate timestamp. That revision is displayed.
  3. Click the Edit source tab at the top of the page. A warning is displayed:
    Warning: You are editing an out-of-date revision of this page. If you save it, any changes made since this revision will be lost.
  4. Write the revision timestamp (displayed at the top of page) and a reason why you are reverting page state to the edit summary field.
  5. If satisfied, simply click the Save changes button to revert to this version.
Note:
  • Avoid combining an undo and an edit. Revert the edit first, then make additional changes; do not edit the revision preview.
  • Consider using an especially detailed and verbose edit summary when performing an undo to prevent lengthy discussions.

Creating pages

Before creating a new page, please consider the following:

  • Is your topic relevant to Arch Linux? Irrelevant or unhelpful articles will be deleted.
  • Is your topic of interest to others? Consider not only what you wish to write about, but also what others may wish to read. Personal notes belong on your user page.
  • Is your topic worthy of a new page? Search the wiki for similar articles. If they exist, consider improving or adding a section to an existing article instead.
  • Will your contribution be significant? Avoid creating stubs unless planning to expand them shortly thereafter.

Creating a new page requires selection of a descriptive title and an appropriate category.

Please read Help:Article naming guidelines and Help:Style#Title for article naming advice. Do not include "Arch Linux" or variations in page titles. This is the Arch Linux wiki; it is assumed that articles will be related to Arch Linux (e.g., "Installing Openbox"; not "Installing Openbox in Arch Linux").

Visit the Table of contents to help choose an appropriate category. Articles may belong to multiple categories, as long as one category is not already the parent of the other (see Help:Style#Categories).

To add a new page to some category (say "My new page" to "Some category") you need to:

  1. Create a page with your new title by browsing to https://wiki.archlinux.org/title/My_new_page (remember to replace "My_new_page" with the intended title!)
  2. Add [[Category:Some category]] to the top of your page
Note: Do not create uncategorized pages. All pages must belong to at least one category. If you cannot find a suitable category, consider creating a new one.

At this stage the new article is still considered an orphan. To complete the job, take a little extra time to link to the new article from others: this will improve its visibility and encourage more users to contribute to it. Likely candidates are articles about related software, more generic overview pages, or even simple lists such as List of applications.

In some cases it may make sense to instead create a subpage, i.e. a child of another page: subpage titles are separated from the superpage title with "/" symbols (slash). This is often useful to prepare drafts under one's own User page, for example https://wiki.archlinux.org/title/User:Myself/My_new_subpage.

Formatting

Text formatting is accomplished with wiki markup whenever possible; learning HTML is not necessary. Various templates are also available for common formatting tasks; see Help:Template for information about templates. The Help:Cheatsheet summarizes the most common formatting options.

Headings and subheadings

Headings and subheadings are an easy way to improve the organization of an article. If you can see distinct topics being discussed, you can break up an article by inserting a heading for each section. See Help:Style#Section headings and Help:Effective use of headers for style information.

Headings must start from second level, and can be created like this:

== Second-level heading ==

=== Third-level heading ===

==== Fourth-level heading ====

===== Fifth-level heading =====

====== Sixth-level heading ======
Note: First-level headings are not allowed, their formatting is reserved for the article title.

If an article has at least four headings, a table of contents (TOC) will be automatically generated. If this is not desired, place __NOTOC__ in the article. Try creating some headings in the Sandbox and see the effect on the TOC.

Line breaks

An empty line is used to start a new paragraph while single line breaks have no effect in regular paragraphs.

The HTML <br> tag can be used to manually insert line breaks, but should be avoided. A manual break may be justified with other formatting elements, such as lists.

wikitext rendering
This sentence
is broken into
three lines.

This sentence is broken into three lines.

This is paragraph number one.

This is paragraph number two.

This is paragraph number one.

This is paragraph number two.

* This point <br> spans multiple lines
* This point
ends the list
  • This point
    spans multiple lines
  • This point

ends the list

See Help:Style/White space for information on proper use of whitespace characters.

Bold and italics

Bold and italics are added by surrounding a word or phrase with two, three or five apostrophes ('):

wikitext rendering

''italics''

italics

'''bold'''

bold

'''''bold and italics'''''

bold and italics

Strike-out

Use strike-out text to show that the text no longer applies or has relevance.

wikitext rendering
<s>Strike-out text</s>

Strike-out text

Lists

Remember that wiki syntax does not support multi-line list items; every newline character ends the list item definition. To start a new line inside a list item, use the <br> tag. To enter a multi-line code block inside a list item, use Template:bc and escape the content using <nowiki> tags. See also Help:Style/White space and Help:Template.

Bullet points

Bullet points have no apparent order of items.

To insert a bullet, use an asterisk (*). Multiple *s will increase the level of indentation.

wikitext rendering
* First item 
* Second item 
** Sub-item
* Third item 
  • First item
  • Second item
    • Sub-item
  • Third item

Numbered lists

Numbered lists introduce numbering and thus order the list items. You should generally use unordered lists as long as the order in which items appear is not the primary concern.

To create numbered lists, use the number sign or hash symbol (#). Multiple #s will increase the level of indentation.

wikitext rendering
# First item 
# Second item 
## Sub-item
# Third item 
  1. First item
  2. Second item
    1. Sub-item
  3. Third item
# First item
# Second item
#* Sub-item
# Third item
  1. First item
  2. Second item
    • Sub-item
  3. Third item

Definition lists

Definition lists are defined with a leading semicolon (;) and a colon (:) following the term.

wikitext rendering
Definition lists:
; Keyboard: Input device with buttons or keys
; Mouse: Pointing device for two-dimensional input
or
; Keyboard
: Input device with buttons or keys
; Mouse
: Pointing device for two-dimensional input

Definition lists:

Keyboard
Input device with buttons or keys
Mouse
Pointing device for two-dimensional input

or

Keyboard
Input device with buttons or keys
Mouse
Pointing device for two-dimensional input
Use additional colons if a definition has multiple definitions:
; Term
: First definition
: Second definition

Use additional colons if a definition has multiple definitions:

Term
First definition
Second definition

Definition lists must not be simply used for formatting, see W3's examples.

Code block in list items

An example with block code in lists:

wikitext rendering
# First item 
# Second item: {{bc|<nowiki>
code1
code2
code3
</nowiki>}}
# Third item 
  1. First item
  2. Second item:
    code1
    code2
    code3
    
  3. Third item

Indenting

To indent text, place a colon (:) at the beginning of a line. The more colons you put, the further indented the text will be. A newline marks the end of the indented paragraph.

wikitext rendering
This is not indented at all.
:This is indented slightly.
::This is indented more.

This is not indented at all.

This is indented slightly.
This is indented more.
Note: Use indentation only when strictly necessary to obtain the desired layout. In talk pages, use it to indent replies (see Help:Discussion).

Code

To add code to the wiki, use one of the code formatting templates. Alternatively, simply start each line with a single whitespace character, for example:

 $ echo Hello World

See also Help:Style#Code formatting.

Tables

Tip: See Mediawiki Tables Generator to automatically generate tables.

Used effectively, tables can help organize and summarize swaths of data. For advanced table syntax and formatting, see Help:Table.

wikitext rendering
{| class="wikitable"
|+ Tabular data
! Distro !! Color
|-
| Arch || Blue
|-
| Gentoo || Purple
|-
| Ubuntu || Orange
|}
Tabular data
Distro Color
Arch Blue
Gentoo Purple
Ubuntu Orange
{| class="wikitable"
! Filesystem !! Size !! Used !! Avail !! Use% !! Mounted on
|-
| rootfs || 922G || 463G || 413G || 53% || /
|-
| /dev || 1.9G || 0 || 1.9G || 0% || /dev
|}
Filesystem Size Used Avail Use% Mounted on
rootfs 922G 463G 413G 53% /
/dev 1.9G 0 1.9G 0% /dev

Links

Links are essential to help readers navigate the site. In general, editors should ensure that every article contains outgoing links to other articles (avoid dead-end pages) and is referenced by incoming links from other articles (the what links here special page can be used to display incoming links). See also Help:Style/Formatting and punctuation#First instances.

Internal links

You can extensively cross-reference existing wiki pages using internal links. To make a link to another page on the same wiki, just put the title in double square brackets.

For example, if you want to make a link to, say, the pacman article, use:

[[pacman]]
Note: If the target page does not exist, the result will be a red link, which should be avoided as per Help:Style#Hypertext metaphor.

If you want to use words other than the article title as the text of the link, you can use a label after the pipe symbol ("|") to provide an alternative text.

For example:

The [[ArchWiki:About|ArchWiki]] is the primary documentation source for Arch Linux. 

...is rendered as:

The ArchWiki is the primary documentation source for Arch Linux.
Tip: The pipe symbol ("|"), a.k.a. vertical bar symbol, can be composed with Shift+\ on English keyboard layout and similar.

When you want to use the plural of an article title (or add any other suffix) for your link, you can add the extra letters directly outside the double square brackets.

For example:

makepkg is used in conjunction with [[PKGBUILD]]s.

...is rendered as:

makepkg is used in conjunction with PKGBUILDs.

Links to sections of a document

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: Rename to Section links. (Discuss in Help talk:Editing)

To create a link to a section of a document, simply add a # followed by the section's heading.

For example:

[[Help:Editing#Links to sections of a document]]

...is rendered as:

Help:Editing#Links to sections of a document
Tip: If linking to a section within the same page, the page name can be omitted (e.g. [[#Links to sections of a document]]).

Pipe trick

In some cases, it is possible to use the pipe trick to save writing the label of wiki links. The most important cases usable on ArchWiki are:

  1. In article titles, it allows to hide the language suffix. For example, [[Main page (Česky)|]] is turned into Main page.
  2. In links to different namespace or wiki, the pipe trick hides the prefix. For example, [[ArchWiki:About|]] is turned into About and [[wikipedia:Help:Pipe trick|]] is turned into Help:Pipe trick.

When the page is saved, the pipe trick will automatically generate the label for the link and change the wikitext accordingly.

Interlanguage links

See Help:i18n#Interlanguage links

Interwiki links

So-called interwiki links can be used to easily link to articles in other external Wikis, like Wikipedia for example. The syntax for this link type is the wiki name followed by a colon and the article you want to link to enclosed in double square brackets.

If you want to create a link to the Wikipedia:Arch Linux article you can use the following:

[[Wikipedia:Arch Linux]]

Or you can create a piped link with a link label to the Arch Linux Wikipedia article:

[[Wikipedia:Arch Linux|Arch Linux Wikipedia article]]
Note: Using a piped link with a label should be reserved for abbreviating longer URLs.

See mw:Help:Links#Interwiki links.

The list of all interwiki links available on ArchWiki can be viewed at Special:Interwiki and via the API.

Tip: By default, all interwiki links to pages in Wikipedia are considered as links to English pages. If you want to create a link to a page in another language, you may add a language prefix to the page name. For example, to create a link to a Russian page, prefix its name with ru:
[[Wikipedia:ru:Arch Linux]]

results in Wikipedia:ru:Arch Linux.

Note that it depends on the interwiki configuration for the target wiki, so it does not work on every wiki. It works for Wikipedia though.

External links

If you want to link to an external site, just type the full URL for the page you want to link to.

https://archlinux.org/

It is often more useful to give the link an alternative label rather than displaying the URL. Unlike #Internal links, external links with a label use single square brackets and the target URL and the label are separated by a space (not a pipe). For example, to have the link appear as Arch Linux, just type:

[https://archlinux.org/ Arch Linux]

It is also possible to generate an auto-numbered label by simply enclosing the URL with single brackets. This is often preferred to phrases like "see here". To produce a phrase "see [1]", where the number will vary depending on the order of the link on the page, just type:

see [https://archlinux.org/]
Note: When linking to other ArchWiki pages (i.e. the links start with https://wiki.archlinux.org/) use #Internal links. When linking to Wikipedia pages (i.e. the links start with https://en.wikipedia.org/) use #Interwiki links.

Redirects

This article or section needs expansion.

Reason: Should be split into subsections to clearly describe 1) what is a redirect, 2) when/why to redirect a page, 3) how to redirect a page. (Discuss in Help talk:Editing)

To redirect automatically from one page to another, add #redirect and an internal link to the page to be redirected to at the beginning of a page.

For example, you could redirect "Penguins" to "Penguin" with:

#redirect [[Penguin]]

Thus, anyone typing either version in the search box will automatically go to "Penguin".

Redirects also allow keeping track of the reason why links are made, for example grouping them in WhatLinksHere pages, and let quickly update link fragments in case of section renames. As a downside redirects do not show the ultimate link target in the browser.

Before creating a redirect, you can perform a search to check existing compatible ones. For example, Xorg.

See also Help:Style#Redirect pages and Help:Procedures#Deal with talk pages after redirecting a page to another.

Note:

Wiki variables, magic words, and templates

MediaWiki recognizes certain special strings within an article that alter standard behavior. For example, adding the word __NOTOC__ anywhere in an article will prevent generation of a table of contents. Similarly, the word __TOC__ can be used to alter the default position of the table of contents. See Help:Magic words for details.

Templates and variables are predefined portions of wikitext that can be inserted into an article to aid in formatting content.

Variables are defined by the system and can be used to display information about the current page, wiki, or date. For example, use {{SITENAME}} to display the wiki's site name (here it displayed as "ArchWiki"). To set an alternate title header for the current page, another wiki variable can be used: {{DISPLAYTITLE:New Title}}. (But it's very restricted: you are only allowed to change first letter to lowercase and replace spaces with underscores — normalized title string must match with real page name, otherwise it will not work; use {{Lowercase title}} template to display first letter of title in lower case).

Templates, on the other hand, are user-defined. The content of any page can be included in another page by adding {{Namespace:Page Name}} to an article, but this is rarely used with pages outside the Template namespace. (If the namespace is omitted, Template is assumed.) For example, Template:Note, which can be included in an article with the following wikitext:

{{Note|This is a note.}}

...is rendered as:

Note: This is a note.

See Help:Template for more information and a list of available templates such as Template:Tip or Template:Warning.