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)
Line 1: Line 1:
{{org}}
{{org}}
==Character Formatting==
==Character formatting==


===Emphasis===
===Emphasis===
Line 19: Line 19:
You can also enclose the code in a <pre> tag. This is the preferred way for longer code snippets.
You can also enclose the code in a <pre> tag. This is the preferred way for longer code snippets.


==URLs, links==
==Links==
This is quite easy, use single [] or double <nowiki>[[ ]]</nowiki>.
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.
*Internal links: <nowiki>[[Rules]]</nowiki> = [[Rules]].
*To assist you when creating internal links within sentences, you may uncapitalize the first letter of the article: <nowiki>&ldquo;read the [[rules]] for editing&rdquo;</nowiki> = &ldquo;read the [[rules]] for editing&rdquo;.
*Named internal links: <nowiki>[[Rules | rules for editing]]</nowiki> = [[Rules | rules for editing]].
*Contracted 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;.


*Using link anchors (&lt;a name="..."> in HTML):
=== Linking to another Knowledge Base page ===
**Creating anchors. An anchor is created automatically for each section of a page. You can create additional anchors by putting an '''id''' attribute on any HTML tag understood by MediaWiki. Example: <nowiki><div id="anchor">Text with anchor</div></nowiki> = <div id="anchor">Text with anchor</div> Note, that neither <a name="anchor">, nor <a id="anchor"> will work.
* Simply put the exact name of the page inside double brackets. Example: <nowiki>[[Rules]]</nowiki> = [[Rules]].
**Linking to an anchor. You can link to an anchor on a page using this syntax: <nowiki>[[In-house style#Commonly used names|Commonly used names]]</nowiki> = [[In-house style#Commonly used names|Commonly used names]]. For anchors on current page you can use <nowiki>[[#anchor|anchor]]</nowiki> = [[#anchor|anchor]].
* 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===
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==
==Document structure==

Revision as of 08:02, 23 January 2006

Character formatting

Emphasis

  • ''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 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 <pre> tag. This is the preferred way for longer code snippets.

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

  • Simply 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]].
  • You can use lowercase, however, 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 | Commonly used names in the Knowledge Base]] = Commonly used names in the Knowledge Base. 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 this 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

Section headers: =Header Example= 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 (====Subheader Example====)

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

Lists: *,# at the beginning of a line gives

  • Unordered list
  1. Ordered list

For levels of lists, add more *,#s:

    • Unordered list
    1. Ordered list

Indented Text

When you use the : (colon) at the beginning of a line it will be indented.
For example:

:Hello I am the indented line
:Hello I am the next indented line.

Gives:

Hello I am the indented line
Hello I am the next indented line.

Tables

Tables are explained on a separate page.

Miscellaneous

  • For those of us that like center aligned text: <center>'''Me'''</center>

gives you:

Me

Signatures

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

More Information

More advanced editing is explained at Wikipedia's MetaWiki.