= WikiFormatting = Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into 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 [http://moin.sf.net/ MoinWiki]. This page demonstrates the formatting syntax available anywhere WikiFormatting is allowed. == Trac Hacks: !AddComment == Add comments to a page: {{{ [[AddComment(appendonly)]] }}} Has following result: ==== Comment by patrick on Wed Mar 22 14:54:23 2006 ==== Test a Test [[AddComment(appendonly)]] == Trac Hacks: Polling == Adds a polling to a site, syntax: {{{ [[Poll(What do you think of the Poll macro?; Cool; Crap)]] }}} Results in: [[Poll(What do you think of the Poll macro?; Cool; Crap)]] == Trac Hacks: Ticket Box == Simple list of tickets by specifiying ticket numbers. '#' character can be omitted: [[TicketBox(#1,#7,#31)]] {{{ [[TicketBox(#1,#7,#31)]] [[TicketBox(1,7,31)]] }}} List tickets expanded from the report result. Third example uses dynamic variable. The special variable 'USER' can be specified. If not specified, login name (or anonymous) is used: {{{ [[TicketBox({1})]] [[TicketBox([report:1])]] [[TicketBox([report:9?COMPONENT=TicketBox])]] [[TicketBox([report:9?USER=foo])]] }}} Combination of above is allowed. The tickets are listed as sorted and uniq'ed: {{{ [[TicketBox({1),#50,{2},100)]] }}} Specifying a size of the box: {{{ [[TicketBox(500pt,{1})]] [[TicketBox(200px,{1})]] [[TicketBox(25%,{1})]] }}} Specifying a title of the box. single and double quoted string are allowed. If '%d' in title string will be replaced with count of tickets: {{{ [[TicketBox('Related Tickets',#1,#2)]] [[TicketBox("Related Tickets",#1,#2)]] [[TicketBox("There are %d tickets",{1})]] }}} == Trac Hack: Repos log == Display change log for this plugin, back 5 revisions. {{{ [[ChangeLog(/changelogplugin, 5)]] }}} results in: [[ChangeLog(/trunk, 5)]] == Trac Hack: Table of Content == The TocMacro generates a table of contents for the current page or a set of pages. If no arguments are given, a table of contents is generated for the current page, with the top-level title stripped: {{{ [[TOC]] }}} [[TOC]] To generate a table of contents for a set of pages, simply pass them as comma separated arguments to the TOC macro. This is the macro call for the table of contents visible on the right side of this page: {{{ [[TOC(TracGuide, TracInstall, TracUpgrade, TracIni, TracAdmin, TracBackup, TracLogging, TracPermissions, TracWiki, WikiFormatting, TracBrowser, TracRoadmap, TracChangeset, TracTickets, TracReports, TracQuery, TracTimeline, TracRss, TracNotification)]] }}} The following ''control'' arguments change the default behaviour of the TOC macro: || '''Argument''' || '''Meaning''' || || {{{heading=}}} || Override the default heading of "Table of Contents" || || {{{noheading}}} || Suppress display of the heading. || || {{{depth=}}} || Display headings of ''subsequent'' pages to a maximum depth of ''''''. || || {{{inline}}} || Display TOC inline rather than as a side-bar. || || {{{titleindex}}} || Only display the page name and title of each page, similar to TitleIndex. || == Font styles == The Trac wiki support the following font styles: '''bold''', ''italic'', __underline__ and ~~strike-through~~. {{{ The Trac wiki support the following font styles: '''bold''', ''italic'', __underline__ and ~~strike-through~~. }}} == Heading == You can create heading by starting a line with one up to five ''equal\\ '=' characters followed by a single space and the headline text. The line should end with a space followed by the same number of ''equal'' characters. ''Note: As of writing, headings cannot contain TracLinks.'' === Example: === {{{ = Heading = == 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: {{{ Line 1[[BR]]Line 2 }}} Display: Line 1[[BR]]Line 2 Text paragraphs can be indented by starting the lines with two or more spaces. == Lists == The wiki supports both ordered/numbered and unordered lists. Example: {{{ * Item 1 * Item 1.1 * Item 2 1. Item 1 1. Item 1.1 1. Item 2 }}} Display: * Item 1 * Item 1.1 * Item 2 1. Item 1 1. Item 1.1 1. Item 2 == Preformatted text == Block quotes, preformatted text, are suitable for source code snippets, notes and examples. Use three ''curly braces'' wrapped around the text to define a block quote: Example: {{{ {{{ def HelloWorld() print "Hello World" }}} }}} Display: {{{ def HelloWorld() print "Hello World" }}} == Tables == Simple tables can be created like this: {{{ ||Cell 1||Cell 2||Cell 3|| ||Cell 4||Cell 5||Cell 6|| }}} Display: ||Cell 1||Cell 2||Cell 3|| ||Cell 4||Cell 5||Cell 6|| == Links == !Hyperlinks are automatically created for WikiPageNames and urls. !WikiPageLinks can be disabled by prepending an exclamation mark (!) character, such as {{{!WikiPageLink}}}. Examples: TitleIndex, http://www.edgewall.com/. Links can be given a more descriptive title by writing the link followed by a space and a title and all this inside two square brackets. Like this: {{{ * [http://www.edgewall.com/ Edgewall Software] * [wiki:TitleIndex Title Index] }}} Display: * [http://www.edgewall.com/ Edgewall Software] * [wiki:TitleIndex Title Index] === Trac Links === 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 notation: * Tickets: '''!#1''' or '''!ticket:1''' * Reports: '''!{1}''' or '''!report:1''' * Changesets: '''![1]''' or '''!changeset:1''' * Wiki pages: '''CamelCase''' or '''!wiki:CamelCase''' * Milestones: '''!milestone:1.0''' * Files: '''!source:trunk/COPYING''' * A specific file revision: '''!source:/trunk/COPYING#200''' Display: * Tickets: #1 or ticket:1 * Reports: {1} or report:1 * Changesets: [1] or changeset:1 * Wiki pages: CamelCase or wiki:CamelCase * Milestones: milestone:1.0 * Files: source:trunk/COPYING * A specific file revision: source:/trunk/COPYING#200 See TracLinks for more in-depth information. == Escaping Links and WikiNames == You may avoid making hyperlinks out of TracLinks by preceding an expression with a single '!' (exclamation mark). {{{ !NoHyperLink !#42 is not a link }}} Display: !NoHyperLink !#42 is not a link == Images == Urls ending with .png, .gif or .jpg are automatically interpreted as image links, and converted to IMG tags. Example: {{{ http://www.edgewall.com/gfx/trac_example_image.png }}} Display: http://www.edgewall.com/gfx/trac_example_image.png == Macros == Macros are ''custom functions'' to insert dynamic content in a page. See WikiMacros for usage. Example: {{{ [[Timestamp]] }}} Display: [[Timestamp]] == Processors == Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in [wiki:WikiRestructuredText reStructuredText] or [wiki:WikiHtml HTML]. See WikiProcessors for more information. '''Example 1:''' {{{ #!html
{{{
#!html
<h1 style="text-align: right; color: blue">HTML Test</h1>
}}}
}}} Display: {{{ #!html

HTML Test

}}} '''Example 2:''' {{{ #!html
{{{
#!python
class Test:
    def __init__(self):
        print "Hello World"
if __name__ == '__main__':
   Test()
}}}
}}} Display: {{{ #!python class Test: def __init__(self): print "Hello World" if __name__ == '__main__': Test() }}} == Miscellaneous == Four or more dashes will be replaced by a horizontal line (
) {{{ ---- }}} Display: ---- ---- See also: TracLinks, TracGuide, WikiHtml, WikiMacros, WikiProcessors, TracSyntaxColoring.