MozillaZine Knowledge Base:Formatting: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(links; simplified part on anchors, cut stuff that no one uses anyway)
(reorg. etc. to make it easier for newcomers)
Line 1: Line 1:
{{org}}
{{org}}
== Links ==
This is quite easy. Use double <nowiki>[[ ]]</nowiki> or single <nowiki>[ ]</nowiki> 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: <tt><nowiki>[[Rules]]</nowiki></tt> = [[Rules]].
* Be careful about capital letters. Example: to link to the [[Global Inbox]] article, you need to use <tt><nowiki>[[Global Inbox]]</nowiki></tt> and not <tt><nowiki>[[Global inbox]]</nowiki></tt>.
* Lowercase can be used for the first letter in the page name. Example: &ldquo;<tt><nowiki>Read the [[rules]] for editing</nowiki></tt>&rdquo; = &ldquo;Read the [[rules]] for editing&rdquo;.
* To use different display text for the link, insert the pipe character "|" followed by the text you want to show for the link. Example: <tt><nowiki>[[Rules | rules for editing]]</nowiki></tt> = [[Rules | rules for editing]].
* It's possible to link to a specific section in a Knowledge Base page using this syntax: <tt><nowiki>[[page name#section name | display text]]</nowiki></tt>. Example: <tt><nowiki>[[In-house style#Commonly used names | Application and OS names]]</nowiki></tt> = [[In-house style#Commonly used names | Application and OS names]]. For a section in the current page you can omit the page name. Example: <tt><nowiki>[[#Document structure | Headers and lists]]</nowiki></tt> = [[#Document structure | 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: <tt><nowiki>[http://mozilla.org/]</nowiki></tt> = [http://mozilla.org/].
* Named external links: <tt><nowiki>[http://mozilla.org/  Mozilla Home]</nowiki></tt> = [http://mozilla.org/  Mozilla Home].
* Explicit external links: &ldquo;<tt><nowiki>visit http://mozilla.org/ now</nowiki></tt>&rdquo; = &ldquo;visit http://mozilla.org/ now&rdquo;.
==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:
<tt>
<nowiki>== Links ==</nowiki><br>
<nowiki>=== Linking to another Knowledge Base page ===</nowiki><br>
<nowiki>=== Linking to an external site ===</nowiki>
</tt>
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 <nowiki>*</nowiki> or <nowiki>#</nowiki> at the beginning of a line to make an unordered (bulleted) or ordered (numbered) list, respectively. To make a list within a list, use <nowiki>**</nowiki> or <nowiki>##</nowiki> instead. Examples:
<tt>
<nowiki>* list item 1</nowiki><br>
<nowiki>* list item 2</nowiki><br>
<nowiki>** list item 2a</nowiki><br>
<nowiki>** list item 2b</nowiki><br>
<nowiki>* list item 3</nowiki>
</tt>
will produce
* list item 1
* list item 2
** list item 2a
** list item 2b
* list item 3
Whereas using <nowiki>#</nowiki> instead of <nowiki>*</nowiki> 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:
<tt>
<nowiki>:Hello, I am the first indented line.</nowiki><br>
<nowiki>:I am the next indented line.</nowiki><br>
<nowiki>::I am a doubly indented line.</nowiki>
</tt>
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 [[MozillaZine Knowledge Base:Tables | separate page]].
==Character formatting==
==Character formatting==


===Emphasis===
===Emphasis===
*<nowiki>''Two single quotes''</nowiki> = ''Two single quotes''
Although the current [[In-house style | 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:
*<nowiki>'''Three single quotes'''</nowiki> = '''Three single quotes'''
 
*<nowiki>'''''Five single quotes'''''</nowiki> = '''''Five single quotes'''''
*<tt><nowiki>''Two single quotes''</nowiki></tt> = ''Two single quotes''
*<tt><nowiki>'''Three single quotes'''</nowiki></tt> = '''Three single quotes'''
*<tt><nowiki>'''''Five single quotes'''''</nowiki></tt> = '''''Five single quotes'''''


===Code===
===Code===
Code may be entered as monospace lines by beginning a line
with a space. Formatting is preserved.
For example:
for(int a=0;a<1;a++)
    {
      do_something();
    }
HTML and Wiki-code is '''still processed''' in monospace lines.


You can also enclose the code in a &lt;pre&gt; tag. This is the preferred way for longer code snippets.
Code may be entered as monospace lines by beginning each line with a space. For example:


==Links==
<tt><nowiki>&nbsp;user_pref("mail.ui.display.dateformat.default", 2);</nowiki></tt>
This is quite easy. Use double [[]] or single <nowiki>[[ ]]</nowiki> 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 ===
produces
* Simply put the exact name of the page inside double brackets. Example: <nowiki>[[Rules]]</nowiki> = [[Rules]].
* Be careful about capital letters. Example: to link to the [[Global Inbox]] article, you need to use <nowiki>[[Global Inbox]]</nowiki> and not <nowiki>[[Global inbox]]</nowiki>.
* You can use lowercase, however, for the first letter in the page name. Example: <nowiki>&ldquo;Read the [[rules]] for editing&rdquo;</nowiki> = &ldquo;Read the [[rules]] for editing&rdquo;.
* To use different display text for the link, insert the pipe character "|" followed by the text you want to show for the link. Example: <nowiki>[[Rules | rules for editing]]</nowiki> = [[Rules | rules for editing]].
* It's possible to link to a specific section in a Knowledge Base page using this syntax: <nowiki>[[page name#section name | display text]]</nowiki>. Example: <nowiki>[[In-house style#Commonly used names | Commonly used names in the Knowledge Base]]</nowiki> = [[In-house style#Commonly used names | Commonly used names in the Knowledge Base]]. For a section in the current page you can omit the page name. Example: <nowiki>[[#Document structure | Headers and lists]]</nowiki> = [[#Document structure | 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===
  user_pref("mail.ui.display.dateformat.default", 2);
Use this syntax when linking to a page outside the Knowledge Base.
* Numbered external links: <nowiki>[http://mozilla.org/]</nowiki> = [http://mozilla.org/].
* Named external links: <nowiki>[http://mozilla.org/ Mozilla Home]</nowiki> = [http://mozilla.org/  Mozilla Home].
* Explicit external links: <nowiki>&ldquo;visit http://mozilla.org/ now&rdquo;</nowiki> = &ldquo;visit http://mozilla.org/ now&rdquo;.


==Document structure==
This will preserve manually inserted spacing within your text, as in this example:
Section headers: <nowiki>=Header Example=</nowiki> gives you a:
===Header Example===
which will add an entry to the table of contents.
Subsections: in order to have subsections, add one more equal sign to both sides of the code (<nowiki>====Subheader Example====</nowiki>)
====Subheader Example====
and adds an entry to the table of contents.
Note: there are six levels of document headers in MediaWiki, hence six different header code (largest header has one equal sign, second largest has two, etc.)


===Lists===
for(int a=0;a<1;a++)
Lists: <nowiki>*,#</nowiki> at the beginning of a line gives
    {
* Unordered list
      do_something();
# Ordered list
    }
For levels of lists, add more <nowiki>*,#</nowiki>s:
** Unordered list
## Ordered list


===Indented Text===
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 &lt;pre&gt; tags. Also note that HTML and Wiki-code are still processed in monospace lines.
When you use the : (colon) at the beginning of a line it will be indented.<br>
For example:<br>
:Hello I am the indented line
:Hello I am the next indented line.
Gives:<br>
:Hello I am the indented line
:Hello I am the next indented line.


===Tables===
== Signatures ==
[[MozillaZine Knowledge Base:Tables | Tables are explained on a separate page]].


==Miscellaneous==
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:
*For those of us that like center aligned text: <nowiki><center>'''Me'''</center></nowiki>
gives you:<br>
<center>'''Me'''</center>


===Signatures===
* Nickname and date: <tt><nowiki>~~~~</nowiki></tt> = [[User:Heroist|Heroist]] 09:27, 31 Jan 2004 (PST).
*Sign with nickname: <nowiki>~~~</nowiki> = [[User:Heroist|Heroist]] .
* Nickname only: <tt><nowiki>~~~</nowiki></tt> = [[User:Heroist|Heroist]].
*Nickname and date: <nowiki>~~~~</nowiki> = [[User:Heroist|Heroist]] 09:27, 31 Jan 2004 (PST).


==More Information==
==More Information==
More advanced editing is explained at [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide:_Editing_overview Wikipedia's MetaWiki].
More advanced editing is explained at [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide:_Editing_overview Wikipedia's MetaWiki].

Revision as of 14:35, 23 January 2006

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

  1. list item 1
  2. list item 2
    1. list item 2a
    2. list item 2b
  3. 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:

  • Nickname and date: ~~~~ = Heroist 09:27, 31 Jan 2004 (PST).
  • Nickname only: ~~~ = Heroist.

More Information

More advanced editing is explained at Wikipedia's MetaWiki.