MozillaZine Knowledge Base:Formatting
Links
This is quite easy. Use double [[ ]] or single [ ] brackets, depending on whether you are linking to another page within the Knowledge Base or to an external site.
Linking to another Knowledge Base page
- Put the exact name of the page inside double brackets. Example: [[Rules]] = Rules.
- Be careful about capital letters. Example: to link to the Global Inbox article, you need to use [[Global Inbox]] and not [[Global inbox]].
- Lowercase can be used for the first letter in the page name. Example: “Read the [[rules]] for editing” = “Read the rules for editing”.
- To use different display text for the link, insert the pipe character "|" followed by the text you want to show for the link. Example: [[Rules | rules for editing]] = rules for editing.
- It's possible to link to a specific section in a Knowledge Base page using this syntax: [[page name#section name | display text]]. Example: [[In-house style#Commonly used names | Application and OS names]] = Application and OS names. For a section in the current page you can omit the page name. Example: [[#Document structure | Headers and lists]] = Headers and lists. However, be aware that such a link will no longer lead to the specified section if someone edits the target page and changes the section name.
Linking to an external site
Use the following syntax when linking to a page outside the Knowledge Base.
- Numbered external links: [http://mozilla.org/] = [1].
- Named external links: [http://mozilla.org/ Mozilla Home] = Mozilla Home.
- Explicit external links: “visit http://mozilla.org/ now” = “visit http://mozilla.org/ now”.
Document structure
Headers
Section headers within a page are made by putting two or three equal signs on each side of the desired header text: use "==" for a level 2 header or "===" for a level 3 header. Example: in the "Links" section above, the headers were made by inserting the following:
== Links ==
=== Linking to another Knowledge Base page ===
=== Linking to an external site ===
There are actually six levels of headers that can be created in the same fashion, but most articles in the Knowledge Base use only level 2 and level 3 headers.
Lists
Put * or # at the beginning of a line to make an unordered (bulleted) or ordered (numbered) list, respectively. To make a list within a list, use ** or ## instead. Examples:
* list item 1
* list item 2
** list item 2a
** list item 2b
* list item 3
will produce
- list item 1
- list item 2
- list item 2a
- list item 2b
- list item 3
Whereas using # instead of * will produce
- list item 1
- list item 2
- list item 2a
- list item 2b
- list item 3
Indented text
Indenting is used most often in Talk pages. To indent a line, put a : (colon) at the beginning of the line. For example:
:Hello, I am the first indented line.
:I am the next indented line.
::I am a doubly indented line.
produces
- Hello, I am the first indented line.
- I am the next indented line.
- I am a doubly indented line.
Tables
Tables are explained on a separate page.
Character formatting
Emphasis
Although the current style guidelines say that italics and bold should be used as sparingly as possible, there are some situations when you may want to use them. To do so:
- ''Two single quotes'' = Two single quotes
- '''Three single quotes''' = Three single quotes
- '''''Five single quotes''''' = Five single quotes
Code
Code may be entered as monospace lines by beginning each line with a space. For example:
user_pref("mail.ui.display.dateformat.default", 2);
produces
user_pref("mail.ui.display.dateformat.default", 2);
This will preserve manually inserted spacing within your text, as in this example:
for(int a=0;a<1;a++) { do_something(); }
For longer, multiline blocks of code, instead of beginning each line with a space, the preferred way is to enclose the whole block of code in a single set of <pre> tags. Also note that HTML and Wiki-code are still processed in monospace lines.
Signatures
Though signatures are not used in regular Knowledge Base articles, it helpful if you include your signature when commenting in a Talk page, so that people reading the Talk page later can understand who said what when. To insert your signature:
More Information
More advanced editing is explained at Wikipedia's MetaWiki.