Actions

Help

Difference between revisions of "Formatting"

From Mahara Wiki

Line 45: Line 45:
 
* xml
 
* xml
  
For languages not on this list, the formatting will not have a box around it.
+
For languages not on this list, the formatting will not have a box around it. That's due to a limitation in the version of the plugin we're using, which requires us to add that box CSS on a per-language basis. If you want it for additional languages, please ask [https://mahara.org/interaction/forum/index.php?group=1 on the mahara.org forums], or [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Method_2:_Inline_CSS use inline CSS].
  
Here's what it looks like with a box:
+
* Here's what it looks like with a box:
  
 
<source lang="php">
 
<source lang="php">
Line 53: Line 53:
 
</source>
 
</source>
  
Here's what it looks like without:
+
* Here's what it looks like without:
  
 
<source lang="abap">
 
<source lang="abap">
 
lang="abap" does not have a box
 
lang="abap" does not have a box
 
</source>
 
</source>
 
That's due to a limitation in the version of the plugin we're using, which requires us to add that box CSS on a per-language basis. If you want it for additional languages, please ask [https://mahara.org/interaction/forum/index.php?group=1 on the mahara.org forums], or [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Method_2:_Inline_CSS use inline CSS].
 
  
 
== Text formatting markup ==
 
== Text formatting markup ==

Revision as of 16:00, 12 March 2014

You can format your text using wiki markup. This consists of normal characters like asterisks, single quotes or equal signs which have a special function in the wiki, sometimes depending on their position. For example, to format a word in italic, you include it in two pairs of single quotes like ''this''.

Syntax highlighting

We've installed the GeSHi plugin for mediawiki to handle syntax highlighting. To use, you simply enclose your code in a <source> tag. You must provide a lang attribute. You can optionally add enclose="div" which will allow the code to wrap in narrow windows.

<source lang="php" enclose="div">
<?php
$foo = "PHP code goes here!";
echo $foo;
die();
</source>
<?php
$foo = "PHP code goes here!"
echo $foo;
die();
<source lang="smarty" enclose="div">
{include file="header.tpl"}
<!-- Dwoo stuff goes here -->
<p><b>Sorry!</b> There's no specific "dwoo" syntax setting, but the "smarty" one is close enough I think.</p>
{$hard_coded|safe}
</source>
{include file="header.tpl"}
<!-- Dwoo stuff goes here -->
<p><b>Sorry!</b> There's no specific "dwoo" syntax setting, but the "smarty" one is close enough I think.</p>
{$hard_coded|safe}

Supported languages

See this link for a list of all supported languages. The ones that are most likely to be useful for Mahara are:

  • php
  • smarty (use this for Dwoo templates)
  • javascript
  • css
  • html5
  • sql
  • bash
  • xml

For languages not on this list, the formatting will not have a box around it. That's due to a limitation in the version of the plugin we're using, which requires us to add that box CSS on a per-language basis. If you want it for additional languages, please ask on the mahara.org forums, or use inline CSS.

  • Here's what it looks like with a box:
lang="php" has a box
  • Here's what it looks like without:
lang="abap" does not have a box

Text formatting markup

Description You type You get
character (inline) formatting – applies anywhere
Italic text
''italic''

italic

Bold text
'''bold'''

bold

Bold and italic
'''''bold & italic'''''

bold & italic

Escape wiki markup
<nowiki>no ''markup''</nowiki>

no ''markup''

section formatting – only at the beginning of the line
Headings of different levels
== Level 2 ==
=== Level 3 ===
==== Level 4 ====
===== Level 5 =====
====== Level 6 ======

Note:

Level 2

Level 3

Level 4

Level 5
Level 6
Horizontal rule
Text above
----
Text below

Text above


Text below

Bullet list
* Start each line
* with an [[Wikipedia:asterisk|asterisk]] (*).
** More asterisks gives deeper
*** and deeper levels.
* Line breaks<br />don't break levels.
*** But jumping levels creates empty space.
Any other start ends the list.
  • Start each line
  • with an asterisk (*).
    • More asterisks gives deeper
      • and deeper levels.
  • Line breaks
    don't break levels.
      • But jumping levels creates empty space.

Any other start ends the list.

Numbered list
# Start each line
# with a [[Wikipedia:Number_sign|number sign]] (#).
## More number signs gives deeper
### and deeper
### levels.
# Line breaks<br />don't break levels.
### But jumping levels creates empty space.
# Blank lines

# end the list and start another.
Any other start also
ends the list.
  1. Start each line
  2. with a number sign (#).
    1. More number signs gives deeper
      1. and deeper
      2. levels.
  3. Line breaks
    don't break levels.
      1. But jumping levels creates empty space.
  4. Blank lines
  1. end the list and start another.

Any other start also ends the list.

Definition list
;item 1
: definition 1
;item 2
: definition 2-1
: definition 2-2
item 1
definition 1
item 2
definition 2-1
definition 2-2
Adopting definition list to indent text
: Single indent
:: Double indent
::::: Multiple indent

Note: This workaround may be controversial from the viewpoint of accessibility.
Single indent
Double indent
Multiple indent
Mixture of different types of list
# one
# two
#* two point one
#* two point two
# three
#; three item one
#: three def one
# four
#: four def one
#: this looks like a continuation
#: and is often used
#: instead<br />of <nowiki><br /></nowiki>
# five
## five sub 1
### five sub 1 sub 1
## five sub 2

Note: The usage of #: and *: for breaking a line within an item may also be controversial.
  1. one
  2. two
    • two point one
    • two point two
  3. three
    three item one
    three def one
  4. four
    four def one
    this looks like a continuation
    and is often used
    instead
    of <br />
  5. five
    1. five sub 1
      1. five sub 1 sub 1
    2. five sub 2
Preformatted textTemplate:Anchor
 Start each line with a space.
 Text is '''preformatted''' and
 ''markups'' '''''can''''' be done

Note: This way of preformatting only applies to section formatting. Character formatting markups are still effective.
Start each line with a space.
Text is preformatted and
markups can be done
Preformatted text blocks
 <nowiki>Start with a space in the first column,
(before the <nowiki>).

Then your block format will be
    maintained.
 
This is good for copying in code blocks:

def function():
    """documentation string"""

    if True:
        print True
    else:
        print False</nowiki>
Start with a space in the first column.
(before the <nowiki>).

Then your block format will be
    maintained.

This is good for copying in code blocks:

def function():
    """documentation string"""

    if True:
        print True
    else:
        print False 

Paragraphs

MediaWiki ignores single line breaks. To start a new paragraph, leave an empty line. You can force a line break within a paragraph with the HTML tags <br />.

HTML tags

Some HTML tags are allowed in MediaWiki, for example <code>, <div>, <span> and <font>. These apply anywhere you insert them.

Description You type You get
Underline
<u>Underline</u>

Underline

Strikethrough
<del>Strikethrough</del>

or

<s>Strikethrough</s>

or

<strike>Strikethrough</strike>

Strikethrough

or

Strikethrough

or

Strikethrough

Fixed width text
<code>Source code</code>

or

<tt>Fixed width text</tt>

Source code

or

Fixed width text

Blockquotes
text above
text above
<blockquote>blockquote</blockquote>
text below
text below

text above text above

blockquote

text below text below

Comment
<!-- This is a comment -->
Comments are only visible
in the edit window.

Comments are only visible in the edit window.

Completely preformatted text
<pre> Text is '''preformatted''' and
''markups'' '''''cannot''''' be done</pre>

Note: For marking up of preformatted text, check the "Preformatted text" entry at the bottom of the previous table.
 Text is '''preformatted''' and
''markups'' '''''cannot''''' be done
Customized preformatted text
<pre style="color:red">
Text is '''preformatted'''
with a style and
''markups'' '''''cannot''''' be done
</pre>

Note: A CSS style can be named within the style property.
Text is '''preformatted'''
with a style and
''markups'' '''''cannot''''' be done

HTML symbols

An HTML symbol entity is a sequence of characters that produces one particular character. For example, &rarr; produces a right arrow "" and &mdash; produces an em dash "". HTML symbol entities are allowed in MediaWiki and are sometimes used in advanced editing for two main reasons: to insert characters not normally available on keyboards:

&copy; → ©
&delta; → δ

and to prevent the parser from interpreting and displaying HTML tags and symbols:

&amp;euro; → &euro;
&euro; →
&lt;span style="color:green;">Green&lt;/span> → <span style="color:green;">Green</span>
<span style="color:green;">Green</span> → Green

The following is a list of characters that can be produced using HTML symbols. Hover any character to find out the symbol that produces it. Some symbols not available in the current font will appear as empty squares.

HTML Symbol Entities
Á á Â â ´ Æ æ À à Α α & Å å Ã ã Ä ä Β β ¦ Ç ç ¸ ¢
Χ χ ˆ © ¤ ° Δ δ ÷ É é Ê ê È è Ε ε Η η
Ð ð Ë ë ƒ ½ ¼ ¾ Γ γ > Í í Î î ¡ Ì ì Ι ι
¿ Ï ï Κ κ Λ λ « < ¯ µ · Μ μ  
¬ Ñ ñ Ν ν Ó ó Ô ô Œ œ Ò ò Ω ω Ο ο ª º Ø ø Õ õ Ö
ö Φ φ Π π ϖ ± £ Ψ ψ " » ® Ρ ρ
Š š § ­ Σ σ ς ¹ ² ³ ß Τ τ Θ θ ϑ Þ þ ˜
× Ú ú Û û Ù ù ¨ ϒ Υ υ Ü ü Ξ ξ Ý ý ¥ ÿ Ÿ Ζ ζ

Other formatting

Beyond the text formatting markup shown above, here are some other formatting references:

Template:Languages