Edgewall Software

Version 9 (modified by Christian Boos, 14 years ago) ( diff )

show off #4235 fix ;-)

This page documents the 0.12 release. Documentation for other releases can be found here.

WikiFormatting

Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into a flexible and powerful whole.

Trac has a built in small and powerful wiki rendering engine. This wiki engine implements an ever growing subset of the commands from other popular Wikis, especially MoinMoin and WikiCreole.

This page demonstrates the formatting syntax available anywhere WikiFormatting is allowed.

Font Styles

The Trac wiki supports the following font styles:

Wiki Markup Display
 * '''bold''', 
   ''' triple quotes !''' 
   can be bold too if prefixed by ! ''', 
 * ''italic''
 * '''''bold italic''''' or ''italic and
   ''' italic bold ''' ''
 * __underline__
 * {{{monospace}}} or `monospace`
   (hence `{{{` or {{{`}}} quoting)
 * ~~strike-through~~
 * ^superscript^ 
 * ,,subscript,,
  • bold, triple quotes ''' can be bold too if prefixed by ! ,
  • italic
  • bold italic or italic and italic bold
  • underline
  • monospace or monospace (hence {{{ or ` quoting)
  • strike-through
  • superscript
  • subscript

Notes:

  • {{{...}}} and `...` commands not only select a monospace font, but also treat their content as verbatim text, meaning that no further wiki processing is done on this text.
  • ! tells wiki parser to not take the following characters as wiki format, so pay attention to put a space after !, e.g. when ending bold.
  • all the font styles marks have to be used in opening/closing pairs, and they must nest properly

Headings

You can create heading by starting a line with one up to six equal characters ("=") followed by a single space and the headline text. The headline text can be followed by the same number of = characters, but this is no longer mandatory. The heading might optionally be followed by an explicit id. If not, an implicit but nevertheless readable id will be generated.

Wiki Markup Display
= Heading =
== Subheading
=== About ''this'' ===
=== Explicit id === #using-explicit-id-in-heading
== Subheading #sub2

Subheading

About this

Explicit id

Subheading

Paragraphs

A new text paragraph is created whenever two blocks of text are separated by one or more empty lines.

A forced line break can also be inserted, using:

Wiki Markup Display
Line 1[[BR]]Line 2
Paragraph
one

Paragraph 
two

Line 1
Line 2

Paragraph one

Paragraph two

Lists

The wiki supports both ordered/numbered and unordered lists.

Example:

Wiki Markup Display
 * Item 1
   * Item 1.1
      * Item 1.1.1   
      * Item 1.1.2
      * Item 1.1.3
   * Item 1.2
 * Item 2
- items can start at the beginning of a line
  and they can span multiple lines
  - be careful though to continue the line 
  with the appropriate indentation, otherwise
that will start a new paragraph...

 1. Item 1
   a. Item 1.a
   a. Item 1.b
      i. Item 1.b.i
      i. Item 1.b.ii
 1. Item 2
And numbered lists can also be restarted
with an explicit number:
 3. Item 3
  • Item 1
    • Item 1.1
      • Item 1.1.1
      • Item 1.1.2
      • Item 1.1.3
    • Item 1.2
  • Item 2
  • items can start at the beginning of a line and they can span multiple lines
    • be careful though to continue the line with the appropriate indentation, otherwise

that will start a new paragraph…

  1. Item 1
    1. Item 1.a
    2. Item 1.b
      1. Item 1.b.i
      2. Item 1.b.ii
  2. Item 2

And numbered lists can also be restarted with an explicit number:

  1. Item 3

Definition Lists

The wiki also supports definition lists.

Wiki Markup Display
 llama::
   some kind of mammal, with hair
 ppython::
   some kind of reptile, without hair
   (can you spot the typo?)
llama
some kind of mammal, with hair
ppython
some kind of reptile, without hair (can you spot the typo?)

Note that you need a space in front of the defined term.

Preformatted Text

Block containing preformatted text are suitable for source code snippets, notes and examples. Use three curly braces wrapped around the text to define a block quote. The curly braces need to be on a separate line.

Wiki Markup Display
{{{
def HelloWorld():
    print '''Hello World'''
}}}
def HelloWorld():
    print '''Hello World'''

Note that this kind of block is also used for selecting lines that should be processed through WikiProcessors.

Blockquotes

In order to mark a paragraph as blockquote, indent that paragraph with two spaces.

Wiki Markup Display
Paragraph
  This text is a quote from someone else.

Paragraph

This text is a quote from someone else.

Discussion Citations

To delineate a citation in an ongoing discussion thread, such as the ticket comment area, e-mail-like citation marks (">", ">>", etc.) may be used.

Wiki Markup Display
>> Someone's original text
> Someone else's reply text
>  - which can be any kind of Wiki markup
My reply text

Someone's original text

Someone else's reply text

  • which can be any kind of Wiki markup

My reply text

Note: Some WikiFormatting elements, such as lists and preformatted text, are lost in the citation area. Some reformatting may be necessary to create a clear citation.

Tables

Simple Tables

Simple tables can be created like this:

Wiki Markup Display
||Cell 1||Cell 2||Cell 3||
||Cell 4||Cell 5||Cell 6||
Cell 1Cell 2Cell 3
Cell 4Cell 5Cell 6

Cell headings can be specified by wrapping the content in a pair of '=' characters. Note that the '=' characters have to stick to the cell separators, like this:

Wiki Markup Display
||        ||= stable =||= latest =||
||= 0.10 =||  0.10.5  || 0.10.6dev||
||= 0.11 =||  0.11.6  || 0.11.7dev||
stable latest
0.10 0.10.5 0.10.6dev
0.11 0.11.6 0.11.7dev

Finally, specifying an empty cell means that the next non empty cell will span the empty cells. For example:

Wiki Markup Display
|| 1 || 2 || 3 ||
|||| 1-2 || 3 ||
|| 1 |||| 2-3 ||
|||||| 1-2-3 ||
1 2 3
1-2 3
1 2-3
1-2-3

Note that if the content of a cell "sticks" to one side of the cell and only one, then the text will be aligned on that side. Example:

Wiki Markup Display
||=Text =||= Numbers =||
||left align    ||        1.0||
||  center      ||        4.5||
||      right align||     4.5||
|| default alignment ||   2.5||
||default||         2.5||
||  default ||      2.5||
|| default ||       2.5||
Text Numbers
left align 1.0
center 4.5
right align 4.5
default alignment 2.5
default 2.5
default 2.5
default 2.5

Note that more complex tables can be created using WikiProcessors#Tables.

Hyperlinks are automatically created for WikiPageNames and URLs. WikiPageLinks can be disabled by prepending an exclamation mark "!" character, such as !WikiPageLink.

Wiki Markup Display
TitleIndex, http://www.edgewall.com/, !NotAlink

TitleIndex, http://www.edgewall.com/, NotAlink

Links can be given a more descriptive title by writing the link followed by a space and a title and all this inside square brackets. If the descriptive title is omitted, then the explicit prefix is discarded, unless the link is an external link. This can be useful for wiki pages not adhering to the WikiPageNames convention.

Wiki Markup Display
 * [http://www.edgewall.com/ Edgewall Software]
 * [wiki:TitleIndex Title Index]
 * [wiki:ISO9000]

Wiki pages can link directly to other parts of the Trac system. Pages can refer to tickets, reports, changesets, milestones, source files and other Wiki pages using the following notations:

Wiki Markup Display
 * Tickets: #1 or ticket:1
 * Reports: {1} or report:1
 * Changesets: r1, [1] or changeset:1
 * ...

There are many more flavors of Trac links, see TracLinks for more in-depth information.

Escaping Links and WikiPageNames

You may avoid making hyperlinks out of TracLinks by preceding an expression with a single "!" (exclamation mark).

Wiki Markup Display
 !NoHyperLink
 !#42 is not a link

NoHyperLink #42 is not a link

Images

Urls ending with .png, .gif or .jpg are no longer automatically interpreted as image links, and converted to <img> tags.

You now have to use the [[Image]] macro. The simplest way to include an image is to upload it as attachment to the current page, and put the filename in a macro call like [[Image(picture.gif)]].

In addition to the current page, it is possible to refer to other resources:

  • [[Image(wiki:WikiFormatting:picture.gif)]] (referring to attachment on another page)
  • [[Image(ticket:1:picture.gif)]] (file attached to a ticket)
  • [[Image(htdocs:picture.gif)]] (referring to a file inside project htdocs)
  • [[Image(source:/trunk/trac/htdocs/trac_logo_mini.png)]] (a file in repository)
Wiki Markup Display
[[Image(htdocs:../common/trac_logo_mini.png)]]

trac_logo_mini.png

See WikiMacros for further documentation on the [[Image()]] macro.

Macros

Macros are custom functions to insert dynamic content in a page.

Wiki Markup Display
[[RecentChanges(Trac,3)]]

See WikiMacros for more information, and a list of installed macros.

The detailed help for a specific macro can also be obtained more directly by appending a "?" to the macro name.

Wiki Markup Display
[[MacroList?]]

[[MacroList]]

Display a list of all installed Wiki macros, including documentation if available.

Optionally, the name of a specific macro can be provided as an argument. In that case, only the documentation for that macro will be rendered.

Note that this macro will not be able to display the documentation of macros if the PythonOptimize option is enabled for mod_python!

Processors

Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in reStructuredText or HTML.

Wiki Markup Display

Example 1:

{{{
#!html
<h1 style="text-align: right; color: blue">HTML Test</h1>
}}}

Example 1:

HTML Test

Example 2:

{{{
#!python
class Test:

    def __init__(self):
        print "Hello World"
if __name__ == '__main__':
   Test()
}}}

Example 2:

class Test:
    def __init__(self):
        print "Hello World"
if __name__ == '__main__':
   Test()

Example 3:

{{{
#!perl
my ($test) = 0;
if ($test > 0) {
    print "hello";
}
}}}

Example 3:

my ($test) = 0;
if ($test > 0) {
    print "hello";
}

See WikiProcessors for more information.

Comments

Comments can be added to the plain text. These will not be rendered and will not display in any other format than plain text.

Wiki Markup Display
Nothing to
{{{
#!comment
Your comment for editors here
}}}
see ;-)

Nothing to

see ;-)

Miscellaneous

An horizontal line can be used to separated different parts of your page:

Wiki Markup Display
Four or more dashes will be replaced 
by a horizontal line (<HR>)
----
See?

Four or more dashes will be replaced by a horizontal line (<HR>)


See?


See also: TracLinks, TracGuide, WikiHtml, WikiMacros, WikiProcessors, TracSyntaxColoring.

Note: See TracWiki for help on using the wiki.