Difference between revisions of "Help:Text formatting"

m (External Links)
(Formatting)
Line 1: Line 1:
MediaWiki '''Formatting''' is the technique of transforming text in articles. For example, making text '''bold''', ''italics'', or '''''bold italics'''''. A comprehensive tutorial follows.
+
'''Formatting''' is the technique of transforming text in articles. For example, making text '''bold''' or ''italics''. A comprehensive tutorial follows, arranged generally in order from simpler formatting to advanced formatting.
 +
 
 +
=== Headings ===
 +
 
 +
To create a heading, surround the text you wish to make a header with a number of equals signs, corresponding to the size of the heading. Here are the six types of headings:
 +
<pre><nowiki>
 +
= Heading 1 =
 +
== Heading 2 ==
 +
=== Heading 3 ===
 +
==== Heading 4 ====
 +
===== Heading 5 =====
 +
====== Heading 6 ======
 +
</nowiki></pre>
 +
Resulting in:
 +
<h1>Heading 1</h1><!-- Slashes in closing tags should not be here in order to hide headers TOC. It does not work (due to deprecated version?)-->
 +
<h2>Heading 2</h2>
 +
<h3>Heading 3</h3>
 +
<h4>Heading 4</h4>
 +
<h5>Heading 5</h5>
 +
<h6>Heading 6</h6>
 +
 
 +
Use of level one headings is not recommended, as this is the level of the title of the page. Simply start at level two and go to the next level for subheadings.
 +
 
 +
=== Table of Contents ===
 +
 
 +
If you have more than four headers in a page, a table of contents box listing the headers appears at the top. You can remove the table of contents using <tt><nowiki>__NOTOC__</nowiki></tt>. You can place the table of contents in a different position using <tt><nowiki>__TOC__</nowiki></tt>
 +
 
 +
== Links ==
 +
 
 +
=== Internal Links ===
 +
 
 +
To turn text into an internal link (i.e. a link to a page within the wiki), you format the text as follows: <tt><nowiki>[[FULL NAME OF ARTICLE HERE]]</nowiki></tt>. This would link to the article ''FULL NAME OF ARTICLE HERE''.
 +
 
 +
To link to an article but display text other than the article name, you format as follows: <tt><nowiki>[[FULL NAME OF ARTICLE HERE|TEXT TO DISPLAY HERE]]</nowiki></tt> This results in: [[FULL NAME OF ARTICLE HERE|TEXT TO DISPLAY HERE]]
 +
 
 +
If a link that you post is colored red, it means the article does not exist yet.
 +
 
 +
=== External Links ===
 +
 
 +
To turn text into an external link (a link to a page outside the wiki), you format the text as follows:
 +
<nowiki>[//URL_OF_PAGE_HERE]</nowiki>
 +
Note that there cannot be any spaces in the URL. The // sets to http(s):// depending on your browser's default. You should replace <tt>http(s)://artofproblemsolving.com</tt> with <tt><nowiki>{{SERVER}}</nowiki></tt> in external links.
 +
 
 +
To link to a website but display text other than the website's URL, you format as follows:
 +
<nowiki>[//URL_OF_PAGE_HERE TEXT TO DISPLAY HERE]</nowiki>
 +
Note the space between the URL of the page and the text to display. The above results in: [//URL_OF_PAGE_HERE TEXT TO DISPLAY HERE].
 +
 
 
== Text Formatting ==
 
== Text Formatting ==
=== Simple Text Formatting ===
 
====Bold, Italics====
 
The following code will give you '''bold''' text:
 
<nowiki>[b]BOLD TEXT GOES HERE[/b]</nowiki>
 
As you can see, three apostrophes the text gives you the desired format.
 
<br />
 
<br />
 
The following code will give you ''italic'' text:
 
<nowiki>[i]ITALIC TEXT GOES HERE[/i]</nowiki>
 
Here, two apostrophes are required.
 
<br />
 
<br />
 
These two formatting tricks can be combined to make '''''bold italic text''''', like so:
 
<nowiki>'''''BOLD AND ITALICS'''''</nowiki>
 
  
====Headers====
+
{| class="wikitable"
To create a header, surround the text you wish to make a header with a number of equals signs. <br />
+
! Description !! Input !! Output
Here are the six types of headers:<br>
+
|-
<nowiki>
+
| Triple apostrophes give you bold text || <tt><nowiki>'''Example'''</nowiki></tt> || '''Example'''
=Header 1=
+
|-
==Header 2==
+
| Double apostrophes give you italic text || <tt><nowiki>''Example''</nowiki></tt> || '''Example'''
===Header 3===
+
|-
====Header 4====
+
| These two formatting tricks can be combined to make bold italic text || <tt><nowiki>'''''Example'''''</nowiki></tt>. || '''''Example'''''
=====Header 5=====
+
|-
======Header 6======
+
| Underlining text uses HTML tags. || <tt><nowiki><u>Example</u> || <u>Example</u>
</nowiki>
+
|-
Results in:<br>
+
| Strikethrough uses HTML tags. || <tt><nowiki><s>Example</s></nowiki></tt> || <s>Example</s>
=Header 1=
+
|-
==Header 2==
+
| Small text || <tt><nowiki><small>Example</small><nowiki></tt> || <small>Example</small>
===Header 3===
+
|-
====Header 4====
+
| Inline code || <tt><nowiki><tt>Example></tt></nowiki></tt> || <tt>Example</tt>
=====Header 5=====
+
|}
======Header 6======
+
 
If you have more than four headers in a page, a table of contents box listing the headers appears at the top.
+
== Section Formatting ==  
===More Complex Text Formatting ===
+
 
====Boxes and Unformatting====  
+
These can only be done at the start of a line. This includes headers.
To achieve a grey box with mono type text like the ones above, simply put a space before the line(s) you wish to place in the box, like so:
+
 
 +
=== Boxes ===
 +
 
 +
To achieve a grey box with mono type text like the ones above, use the <tt><pre/></tt> tags or simply put a space before the line(s) you wish to place in the box, like so:
 
  Whee, what fun!
 
  Whee, what fun!
 
And an example of multiple lines:
 
And an example of multiple lines:
Line 43: Line 78:
 
  Second!
 
  Second!
 
  Third?
 
  Third?
Note that this does not stop any code in the boxes from being parsed. <br />
+
Note that this does not stop any code in the boxes from being parsed.
i.e.
 
 
  '''This text is still bold, though it's in a box'''
 
  '''This text is still bold, though it's in a box'''
To prevent parsing, you must do this:
 
<nowiki><nowiki>NON FORMATTED TEXT AND ANYTHING ELSE HERE</nowiki></nowiki>
 
This removes '''all''' wiki formatting from the contained text.
 
  
====Lists====
+
=== Lists ===
 +
 
 
Lists are a group of items that are, as the name implies, ''listed'' one by one on separate lines. There are two types of lists: ordered and unordered.  
 
Lists are a group of items that are, as the name implies, ''listed'' one by one on separate lines. There are two types of lists: ordered and unordered.  
=====Ordered Lists=====
+
 
Each item in an ordered list is preceded by it's number in the list. To create an ordered list, simply insert the symbol <nowiki>#</nowiki> before each list item. <br />
+
==== Ordered Lists ====
Example:
+
 
 +
Each item in an ordered list is preceded by its number in the list. To create an ordered list, simply insert the symbol <nowiki>#</nowiki> before each list item. Example:
 
  <nowiki>
 
  <nowiki>
  #This is number 1.
+
  # This is number 1.
  #Two!  
+
  # Two!  
  #Three!
+
  # Three.
  #Four.
+
  # Four. Yawn...
#Five. Yawn...
 
 
  #etc...
 
  #etc...
 
  </nowiki>
 
  </nowiki>
 
Results in:
 
Results in:
#This is number 1.
+
# This is number 1.
#Two!  
+
# Two!  
#Three!
+
# Three.
#Four.
+
# Four. Yawn...
#Five. Yawn...
+
# etc...
#etc...
+
 
=====Unordered Lists=====
+
==== Unordered Lists =====
Each item in an unordered list is preceded by a small box. To create an unordered list, insert a <nowiki>*</nowiki> before each list item.<br />Example:
+
 
 +
Each item in an unordered list is preceded by a small box. To create an unordered list, insert a <nowiki>*</nowiki> before each list item.Example:
 
  <nowiki>
 
  <nowiki>
  *This is unordered.
+
  * This is unordered.
  *Oh, the chaos!
+
  * Oh, the chaos!
  *Pretty nice.
+
  * Pretty nice.
 
  </nowiki>
 
  </nowiki>
 
Results in:
 
Results in:
*This is unordered.
+
* This is unordered.
*Oh, the chaos!
+
* Oh, the chaos!
*Pretty nice.
+
* Pretty nice.
=====Nested Lists=====
+
==== Nested Lists ====
You can also nest both ordered and unordered lists. <br />
+
 
 +
You can also nest both ordered and unordered lists. <br>
 
This is how to do it:
 
This is how to do it:
 
  <nowiki>
 
  <nowiki>
  *Cool.
+
  * Cool.
  *Yeah.
+
  * Yeah.
  **Hey, it's a sub item!
+
  ** Hey, it's a sub-item!
  **This is great.
+
  ** This is great.
  ***Yup.
+
  *** Yup.
  ****It is.
+
  **** It is.
  ***Really?
+
  *** Really?
  **Of course.
+
  ** Of course.
  *Okay.
+
  * Okay.
  #You can do that for numbered lists too.
+
  # You can do that for numbered lists too.
  #Yup.
+
  # Yup.
  ##It works.
+
  ## It works.
  ##Yay!
+
  ## Yay!
  ###w00t!
+
  ### w00t!
  #Hurray!
+
  # Hurray!
 
  </nowiki>
 
  </nowiki>
 
Results in:
 
Results in:
*Cool.
+
* Cool.
*Yeah.
+
* Yeah.
**Hey, it's a sub item!
+
** Hey, it's a sub item!
**This is great.
+
** This is great.
***Yup.
+
*** Yup.
****It is.
+
**** It is.
***Really?
+
*** Really?
**Of course.
+
** Of course.
*Okay.
+
* Okay.
#You can do that for numbered lists too.
+
# You can do that for numbered lists too.
#Yup.
+
# Yup.
##It works.
+
## It works.
##Yay!
+
## Yay!
###w00t!
+
### w00t!
#Hurray!
+
# Hurray!
 
There is also a way to nest ordinary text, namely, to place the a colon (<nowiki>:</nowiki>) before the nested text.
 
There is also a way to nest ordinary text, namely, to place the a colon (<nowiki>:</nowiki>) before the nested text.
 
  <nowiki>
 
  <nowiki>
 
  Hi
 
  Hi
  :Nest!
+
  : Nest!
  ::Double nest!
+
  :: Double nest!
  :::Triple nest!
+
  ::: Triple nest!
 
  </nowiki>
 
  </nowiki>
Results in:<br>
+
 
 +
Results in:
 +
 
 
Hi
 
Hi
 
:Nest!
 
:Nest!
Line 130: Line 166:
 
:::Triple nest!
 
:::Triple nest!
  
===Links===
+
== Unformatting ==
====Internal Links====
 
To turn text into an internal link (i.e. a link to a page within the wiki), you format the text as follows:
 
<nowiki>[[FULL NAME OF ARTICLE HERE]]</nowiki>
 
This would link to the article ''FULL NAME OF ARTICLE HERE''.<br />
 
To link to an article but display text other than the article name, you format as follows:
 
<nowiki>[[FULL NAME OF ARTICLE HERE|TEXT TO DISPLAY HERE]]</nowiki>
 
This results in: <br />
 
[[FULL NAME OF ARTICLE HERE|TEXT TO DISPLAY HERE]]<br />
 
If a link that you post is colored red, it means the article does not exist yet.
 
====External Links====
 
To turn text into an external link (i.e. a link to a page outside the wiki), you format the text as follows:
 
<nowiki>[//URL_OF_PAGE_HERE]</nowiki>
 
Note that there can not be any spaces in the URL. The // sets to https:// or http:// depending on your browser's default.
 
  
To link to a website but display text other than the website's URL, you format as follows:
+
To prevent parsing, you must do this:
  <nowiki>[//URL_OF_PAGE_HERE TEXT TO DISPLAY HERE]</nowiki>
+
  <nowiki><nowiki>NON FORMATTED TEXT AND ANYTHING ELSE HERE</nowiki></nowiki>
Note the space between the url of the page and the text to display. The above results in:
+
This removes '''all''' wiki formatting from the contained text.
 
 
[//URL_OF_PAGE_HERE TEXT TO DISPLAY HERE]
 
  
This concludes our article on basic text formatting. To learn about more complex text formatting, it is recommended you read the [[MediaWiki]] and [[Wikipedia]] articles.
 
  
 +
This concludes our article on basic text formatting. To learn about more complex text formatting, it is recommended you read the [[MediaWiki]] articles.
  
 
{{tutorial}}
 
{{tutorial}}

Revision as of 20:26, 9 April 2025

Formatting is the technique of transforming text in articles. For example, making text bold or italics. A comprehensive tutorial follows, arranged generally in order from simpler formatting to advanced formatting.

Headings

To create a heading, surround the text you wish to make a header with a number of equals signs, corresponding to the size of the heading. Here are the six types of headings:

= Heading 1 =
== Heading 2 ==
=== Heading 3 ===
==== Heading 4 ====
===== Heading 5 =====
====== Heading 6 ======

Resulting in:

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Use of level one headings is not recommended, as this is the level of the title of the page. Simply start at level two and go to the next level for subheadings.

Table of Contents

If you have more than four headers in a page, a table of contents box listing the headers appears at the top. You can remove the table of contents using __NOTOC__. You can place the table of contents in a different position using __TOC__

Links

Internal Links

To turn text into an internal link (i.e. a link to a page within the wiki), you format the text as follows: [[FULL NAME OF ARTICLE HERE]]. This would link to the article FULL NAME OF ARTICLE HERE.

To link to an article but display text other than the article name, you format as follows: [[FULL NAME OF ARTICLE HERE|TEXT TO DISPLAY HERE]] This results in: TEXT TO DISPLAY HERE

If a link that you post is colored red, it means the article does not exist yet.

External Links

To turn text into an external link (a link to a page outside the wiki), you format the text as follows:

[//URL_OF_PAGE_HERE]

Note that there cannot be any spaces in the URL. The // sets to http(s):// depending on your browser's default. You should replace http(s)://artofproblemsolving.com with {{SERVER}} in external links.

To link to a website but display text other than the website's URL, you format as follows:

[//URL_OF_PAGE_HERE TEXT TO DISPLAY HERE]

Note the space between the URL of the page and the text to display. The above results in: TEXT TO DISPLAY HERE.

Text Formatting

Description Input Output
Triple apostrophes give you bold text '''Example''' Example
Double apostrophes give you italic text ''Example'' Example
These two formatting tricks can be combined to make bold italic text '''''Example'''''. Example
Underlining text uses HTML tags. <u>Example</u> || <u>Example</u> |- | Strikethrough uses HTML tags. || <tt><nowiki><s>Example</s> Example
Small text <small>Example</small><nowiki></tt> || <small>Example</small> |- | Inline code || <tt><nowiki><tt>Example></tt> Example

Section Formatting

These can only be done at the start of a line. This includes headers.

Boxes

To achieve a grey box with mono type text like the ones above, use the

tags or simply put a space before the line(s) you wish to place in the box, like so:

Whee, what fun!

And an example of multiple lines:

First.
Second!
Third?

Note that this does not stop any code in the boxes from being parsed.

This text is still bold, though it's in a box

Lists

Lists are a group of items that are, as the name implies, listed one by one on separate lines. There are two types of lists: ordered and unordered.

Ordered Lists

Each item in an ordered list is preceded by its number in the list. To create an ordered list, simply insert the symbol # before each list item. Example:

 # This is number 1.
 # Two! 
 # Three.
 # Four. Yawn...
 #etc...
 

Results in:

  1. This is number 1.
  2. Two!
  3. Three.
  4. Four. Yawn...
  5. etc...

Unordered Lists =

Each item in an unordered list is preceded by a small box. To create an unordered list, insert a * before each list item.Example:

 * This is unordered.
 * Oh, the chaos!
 * Pretty nice.
 

Results in:

  • This is unordered.
  • Oh, the chaos!
  • Pretty nice.

Nested Lists

You can also nest both ordered and unordered lists.
This is how to do it:

 * Cool.
 * Yeah.
 ** Hey, it's a sub-item!
 ** This is great.
 *** Yup.
 **** It is.
 *** Really?
 ** Of course.
 * Okay.
 # You can do that for numbered lists too.
 # Yup.
 ## It works.
 ## Yay!
 ### w00t!
 # Hurray!
 

Results in:

  • Cool.
  • Yeah.
    • Hey, it's a sub item!
    • This is great.
      • Yup.
        • It is.
      • Really?
    • Of course.
  • Okay.
  1. You can do that for numbered lists too.
  2. Yup.
    1. It works.
    2. Yay!
      1. w00t!
  3. Hurray!

There is also a way to nest ordinary text, namely, to place the a colon (:) before the nested text.

 Hi
 : Nest!
 :: Double nest!
 ::: Triple nest!
 

Results in:

Hi

Nest!
Double nest!
Triple nest!

Unformatting

To prevent parsing, you must do this:

<nowiki>NON FORMATTED TEXT AND ANYTHING ELSE HERE</nowiki>

This removes all wiki formatting from the contained text.


This concludes our article on basic text formatting. To learn about more complex text formatting, it is recommended you read the MediaWiki articles.

This article is a tutorial about the AoPSWiki or AoPS Forum.