1. Home
  2. Tutorials
  3. Trac Wiki Formatting
Yolinux.com Tutorial

Trac Wiki Formatting:

This tutorial covers the formatting of text for the Trac wiki server.

Trac Wiki Formatting:

Trac has a built-in rendering engine as part of the bug tracker and wiki. To make it easy to use, with no knowledge of HTML, Trac uses what is known as "wiki markup" to define HTML features such as font styles, lists, tables, links, etc.

Display Trac/Wiki Format Code HTML Code Equivalent
A forced line
break.
A forced line[[br]]break. A forced line<br>break.
Bold text '''Bold text''' <b> </b>
Italic text ''Italic text'' <i> </i>
Bold italic text '''''Bold italic text''''' <b><i> </i></b>
Underline __Underline__ <u> </u>
Monospace text {{{Monospace text}}}
or
`Monospace text`
<tt> </tt>
strike-through ~~strike-through~~ <del> </del>
Textsuperscript ^superscript^ <sup> </sup>
Textsubscript ,,subscript,, <sub> </sub>
''' !'''
The "!" escapes the Trac Wiki parser.

Heading

= Heading = Same as HTML "h1"

Subheading

== Subheading == Same as HTML "h2"

Smaller subheading

===Smaller subheading=== Same as HTML "h3"
Text line 1
Text line 2
Text line 1[[BR]]Text line 2 HTML line break <br>
  • List item one
  • List item two
    • Nested item
 * List item one
* List item two
* Nested item

Note: A blank space must be present before the "*".

HTML unordered list:
<ul>
<li>List item one</li>
<li>List item two
<ul>
<li>Nested item</li>
</ul></li>
</ul>
  1. List item one
    1. Nested item
  2. List item two
    1. Nested item
 1. List item one
i. Nested item
2. List item two
a Nested item

Note: A blank space must be present before the list item: "1"

HTML ordered list:
<ol>
<li>List item one
<ol type="lower-roman">
<li>Nested item</li>
</li>
<li>List item two
<ol type="lower-alpha">
<li>Nested item</li>
</ol></li>
</ol>
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
||Cell 1||Cell 2||Cell 3||
||Cell 4||Cell 5||Cell 6||
<table border>
<tr><td>Cell 1</td><td></td>Cell 2</td><td></td>Cell 3</td></tr>
<tr><td>Cell 4</td><td></td>Cell 5</td><td></td>Cell 6</td></tr>
</table>
[[Image(http://URL-goes-here/images/image-file.gif)]]

(URLs ending in .png, .gif or .jpg are interpreted as image links. See "Creating Wiki links" below)

<img src="http://URL-goes-here/images/image-file.gif">
For more information on Trac Wiki formatting, see WikiFormatting

Embed an image included as an "attachment" in the body of a wiki page:

  • At the bottom of the wiki page select "Attach file"
  • Add a GIF, PNG or JPG image file
  • The attachement will be listed at the bottom of the page under the heading "Attachments"
  • Select the hyper-link to the image attachment to view the URL. it will be similar to:
    http://URL-goes-here/trac/ProjectX/attachment/wiki/NameOfWikiPage/image-file.gif
  • In the body of the wiki page specify the wiki format:
    [[Image(http://URL-goes-here/trac/ProjectX/raw-attachment/wiki/NameOfWikiPage/image-file.gif)]]
    or relative path:
    [[Image(/raw-attachment/wiki/NameOfWikiPage/image-file.gif)]]

Note the URL path difference between "attachment/" and "raw-attachment/"

Creating Wiki links:

  • Web URL: [http://URL-goes-here Link text goes here]
    (Traditional HTML link)
  • Create a link to a Trac Milestone:
    • milestone:1.2
    • milestone:"Release maui"
  • Create link to Subversion for given revision changeset:
    • [subversion-revision-number-goes-here]
    • r207, r209
    • changeset:207
    Prefix the Subversion revision number with the letter "r" to have Wiki formatting create a link to the Subversion revision logs.
  • Trac multi-repository configuration - link to Subversion changeset:
    • r207/projectx, r3809/projecty
    Add the Subversion repository name to the revision specified.
  • Create link to Subversion revision logs:
    • r3:5
    • [3:5]
    • log:branches/version6.2-beta#3:5
      Where "version6.2-beta" is the name of the branch for which logs are to be reported.
  • Create link to Trac ticket:
    • #ticket-number-goes-here
    • #45
      Note: To escape the "#" without making it a link, prefix with a "!". i.e. !#45 will not generate a link.
    • ticket:45
  • Create link to a specific file:
    • source:trunk/dira/dirb/file.cpp
    • source:"trunk/dira/dirb/file with spaces.cpp"
      (Files with spaces in the name should be encapsulated in quotes.)
  • Create link to a specific revision of a file: source:trunk/dira/dirb/file.cpp#207
  • Create link to a report:
    • {report-number-goes-here}
    • report:report-number-goes-here
  • Create link to Wiki page: CamelCaseStringGoesHere
    This becomes a link to an HTML page of the same name.
  • Link to a Trac Wiki attachment: attachment:presentation.ppt
Use the command trac-admin /srv/trac/projectX wiki list to view Wiki entries.

Wiki Page Outline:

You can auto-generate a table of contents, also known as a page index or page outline, from the titles on the page with the following entries:

Trac page outline
Page headings and the auto-generated table of contents in the upper right hand corner.
Trac page outline
Wiki markup specifying that a table of contents be generated from the "h2" and "h3" titles. Note that the "h1" is ignored.

   
Bookmark and Share

Advertisements