Changes between Version 1 and Version 2 of WikiFormatting


Ignore:
Timestamp:
Nov 1, 2019, 11:11:25 AM (5 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiFormatting

    v1 v2  
    1 = WikiFormatting =
     1= WikiFormatting
     2
    23[[TracGuideToc]]
    34
    4 Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into a flexible and powerful whole.
    5 
    6 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,
    7 especially [http://moinmoin.wikiwikiweb.de/ MoinMoin].
    8 
    9 
    10 This page demonstrates the formatting syntax available anywhere WikiFormatting is allowed.
    11 
    12 
    13 == Font Styles ==
     5Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into a flexible and unified whole.
     6
     7Trac has a powerful wiki rendering engine that implements a subset of the commands from other popular Wikis, such as [http://moinmo.in/ MoinMoin] and [trac:WikiCreole].
     8
     9The sections below provide an overview for the most common syntax, each link in the ''Category'' column leads you to the more detailed explanation later in this page.
     10
     11The following wiki pages present the advanced features of the Trac wiki markup in more depth:
     12 - TracLinks covers all the possible ways to refer to any Trac resource or parts thereof.
     13 - WikiPageNames covers the various names a wiki page can take, whether in CamelCase or not.
     14 - WikiMacros lists the macros available for generating dynamic content.
     15 - WikiProcessors and WikiHtml details how parts of the wiki text can be processed in special ways.
     16 - [trac:wiki:TracDev/Proposals/AdvancedWikiOperations AdvancedWikiOperations] provides some operations in uncommon or administrative scenarios.
     17
     18== Common wiki markup
     19
     20||= '''Category''' =||= '''Wiki Markup''' =||= '''Display''' =||
     21|-----------------------------------------------------------
     22{{{#!th rowspan=3
     23[#FontStyles Font Styles]
     24}}}
     25|| `'''bold'''`, `''italic''`, `'''''Wikipedia style'''''` || \
     26|| '''bold''', ''italic'', '''''Wikipedia style''''' ||
     27|| `**bold**`, `//italic//`, `**//!WikiCreole style//**` || \
     28|| **bold**, //italic//, **//!WikiCreole style//** ||
     29|| {{{`monospaced (''other markup ignored'')`}}} || \
     30|| `monospaced (''other markup ignored'')` ||
     31|-----------------------------------------------------------
     32||= [#Headings Headings] =||\
     33{{{#!td
     34 {{{
     35 == Level 2
     36 === Level 3 ^([#hn note])^
     37 }}}
     38}}}
     39{{{#!td style="padding-left: 2em"
     40== Level 2
     41=== Level 3 ^([#hn note])^
     42}}}
     43|-----------------------------------------------------------
     44||= [#Paragraphs Paragraphs]  =||\
     45{{{#!td
     46 {{{
     47 First paragraph
     48 on multiple lines.
     49
     50 Second paragraph.
     51 }}}
     52}}}
     53{{{#!td
     54First paragraph
     55on multiple lines.
     56
     57Second paragraph.
     58}}}
     59|-----------------------------------------------------------
     60||= [#Lists Lists] =||\
     61{{{#!td
     62 {{{
     63 * bullet list
     64   on multiple lines
     65   1. nested list
     66     a. different numbering
     67        styles
     68 }}}
     69}}}
     70{{{#!td
     71* bullet list
     72  on multiple lines
     73  1. nested list
     74    a. different numbering
     75       styles
     76}}}
     77|-----------------------------------------------------------
     78{{{#!th
     79[#DefinitionLists Definition Lists]
     80}}}
     81{{{#!td
     82 {{{
     83  term:: definition on
     84         multiple lines
     85 }}}
     86}}}
     87{{{#!td
     88 term:: definition on
     89        multiple lines
     90}}}
     91|-----------------------------------------------------------
     92||= [#PreformattedText Preformatted Text] =||\
     93{{{#!td
     94 {{{
     95 {{{
     96 multiple lines, ''no wiki'',
     97       white space respected
     98 }}}
     99 }}}
     100}}}
     101{{{#!td
     102 {{{
     103 multiple lines, ''no wiki'',
     104       white space respected
     105 }}}
     106}}}
     107|-----------------------------------------------------------
     108||= [#Blockquotes Blockquotes] =||\
     109{{{#!td
     110 {{{
     111   if there's some leading
     112   space the text is quoted
     113 }}}
     114}}}
     115{{{#!td
     116 if there's some leading
     117 space the text is quoted
     118}}}
     119|-----------------------------------------------------------
     120||= [#DiscussionCitations Discussion Citations] =||\
     121{{{#!td
     122 {{{
     123 >> ... (I said)
     124 > (he replied)
     125 }}}
     126}}}
     127{{{#!td
     128>>... (I said)
     129> (he replied)
     130}}}
     131|-----------------------------------------------------------
     132||= [#Tables Tables] =||\
     133{{{#!td
     134 {{{
     135 ||= Table Header =|| Cell ||
     136 ||||  (details below)  ||
     137 }}}
     138}}}
     139{{{#!td
     140||= Table Header =|| Cell ||
     141||||  (details below)  ||
     142}}}
     143|-----------------------------------------------------------
     144{{{#!th rowspan=2
     145[#Links Links]
     146}}}
     147|| `http://trac.edgewall.org` ||\
     148|| http://trac.edgewall.org ||
     149|| `WikiFormatting (CamelCase)` ||\
     150|| WikiFormatting (CamelCase) ||
     151|-----------------------------------------------------------
     152{{{#!th rowspan=5
     153[#TracLinks TracLinks]
     154}}}
     155|| `wiki:WikiFormatting`, `wiki:"WikiFormatting"` ||\
     156|| wiki:WikiFormatting, wiki:"WikiFormatting" ||
     157|| `#1 (ticket)`, `[1] (changeset)`, `{1} (report)` ||\
     158|| #1 (ticket), [1] (changeset), {1} (report) ||
     159|| `ticket:1, ticket:1#comment:1, comment:1:ticket:1` ||\
     160|| ticket:1, ticket:1#comment:1, comment:1:ticket:1 ||
     161|| `Ticket [ticket:1]`, `[ticket:1 ticket one]` ||\
     162|| Ticket [ticket:1], [ticket:1 ticket one] ||
     163|| `Ticket [[ticket:1]]`, `[[ticket:1|ticket one]]` ||\
     164|| Ticket [[ticket:1]], [[ticket:1|ticket one]] ||
     165|-----------------------------------------------------------
     166{{{#!th rowspan=2
     167[#SettingAnchors Setting Anchors]
     168}}}
     169|| `[=#point1 (1)] First...` ||\
     170|| [=#point1 (1)] First... ||
     171|| `see [#point1 (1)]` ||\
     172|| see [#point1 (1)] ||
     173|-----------------------------------------------------------
     174{{{#!th rowspan=3
     175[#Escaping Escaping Markup]
     176}}}
     177|| `!'' doubled quotes` ||\
     178|| !'' doubled quotes ||
     179|| `!wiki:WikiFormatting`, `!WikiFormatting` ||\
     180|| !wiki:WikiFormatting, !WikiFormatting ||
     181|| [[html(<code>`{{{-}}}` triple curly brackets</code>)]] ||\
     182|| `{{{-}}}` triple curly brackets ||
     183|-----------------------------------------------------------
     184||= [#Images Images] =|| `[[Image(`''link''`)]]` || [[Image(htdocs:../common/trac_logo_mini.png)]] ||
     185|-----------------------------------------------------------
     186{{{#!th rowspan=2
     187[#Macros Macros]
     188}}}
     189|| `[[MacroList(*)]]` ||  ''(short list of all available macros)''  ||
     190|| `[[Image?]]` ||  ''(help for the Image macro)''  ||
     191|-----------------------------------------------------------
     192||= [#Processors Processors] =||\
     193{{{#!td
     194 {{{
     195 {{{#!div style="font-size: 80%"
     196 Code highlighting:
     197   {{{#!python
     198   hello = lambda: "world"
     199   }}}
     200 }}}
     201 }}}
     202}}}
     203{{{#!td style="padding-left: 2em"
     204 {{{#!div style="font-size: 80%"
     205 Code highlighting:
     206   {{{#!python
     207   hello = lambda: "world"
     208   }}}
     209 }}}
     210}}}
     211|-----------------------------------------------------------
     212||= [#Comments Comments] =||\
     213{{{#!td
     214 {{{
     215 {{{#!comment
     216 Note to Editors: ...
     217 }}}
     218 }}}
     219}}}
     220||  ''(comment is shown in edit mode only)''  ||
     221|-----------------------------------------------------------
     222||= [#Miscellaneous Miscellaneous] =||\
     223{{{#!td
     224 {{{
     225 Line [[br]] break
     226 Line \\ break
     227 ----
     228 }}}
     229}}}
     230{{{#!td style="padding-left: 2em"
     231Line [[br]] break
     232Line \\ break
     233----
     234}}}
     235
     236== Font Styles
    14237
    15238The Trac wiki supports the following font styles:
    16 {{{
    17  * '''bold''', '''!''' can be bold too''', and '''! '''
     239||= Wiki Markup =||= Display =||
     240{{{#!td
     241  {{{
     242   * '''bold''',
     243     ''' triple quotes !'''
     244     can be bold too if prefixed by ! ''',
     245   * ''italic''
     246   * '''''bold italic''''' or ''italic and
     247     ''' italic bold ''' ''
     248   * __underline__
     249   * {{{monospace}}} or `monospace`
     250     (hence `{{{` or {{{`}}} quoting)
     251   * ~~strike-through~~
     252   * ^superscript^
     253   * ,,subscript,,
     254   * **also bold**, //italic as well//,
     255     and **'' bold italic **'' //(since 0.12)//
     256   * [[span(style=color: #FF0000, a red text )]]
     257  }}}
     258}}}
     259{{{#!td
     260 * '''bold''',
     261   ''' triple quotes !'''
     262   can be bold too if prefixed by ! ''',
    18263 * ''italic''
    19  * '''''bold italic'''''
     264 * '''''bold italic''''' or ''italic and
     265   ''' italic bold ''' ''
    20266 * __underline__
    21267 * {{{monospace}}} or `monospace`
     268   (hence `{{{` or {{{`}}} quoting)
    22269 * ~~strike-through~~
    23270 * ^superscript^
    24271 * ,,subscript,,
    25 }}}
    26 
    27 Display:
    28  * '''bold''', '''!''' can be bold too''', and '''! '''
    29  * ''italic''
    30  * '''''bold italic'''''
    31  * __underline__
    32  * {{{monospace}}} or `monospace`
    33  * ~~strike-through~~
    34  * ^superscript^
    35  * ,,subscript,,
     272 * **also bold**, //italic as well//,
     273   and **'' bold italic **'' //(since 0.12)//
     274 * [[span(style=color: #FF0000, a red text )]]
     275}}}
    36276
    37277Notes:
    38278 * `{{{...}}}` 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.
    39  * {{{ ! }}} 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.
    40 
    41 == Headings ==
    42 
    43 You can create heading by starting a line with one up to five ''equal'' characters ("=")
    44 followed by a single space and the headline text. The line should end with a space
    45 followed by the same number of ''='' characters.
    46 The heading might optionally be followed by an explicit id. If not, an implicit but nevertheless readable id will be generated.
    47 
    48 Example:
    49 {{{
    50 = Heading =
    51 == Subheading ==
    52 === About ''this'' ===
    53 === Explicit id === #using-explicit-id-in-heading
    54 }}}
    55 
    56 Display:
    57 = Heading =
    58 == Subheading ==
    59 === About ''this'' ===
    60 === Explicit id === #using-explicit-id-in-heading
    61 
    62 == Paragraphs ==
     279 * {{{ ! }}} 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.
     280 * all the font styles marks have to be used in opening/closing pairs,
     281   and they must nest properly; in particular, an `''` italic can't be paired
     282   with a `//` one, and `'''` can't be paired with `**`.
     283
     284== Headings
     285
     286You can create a heading by starting a line with one up to six ''equal'' characters (`=`) followed by a single space and the headline text.
     287
     288[=#hn]
     289The headline text can be followed by the same number of `=` characters, but this is not mandatory. That is, `=== Section3 ===` is identical to `=== Section3`.
     290
     291Finally, the heading might optionally be followed by an explicit id. If not, an implicit but nevertheless readable id will be generated.
     292
     293||= Wiki Markup =||= Display =||
     294{{{#!td
     295  {{{
     296  = Heading =
     297  == Subheading
     298  === About ''this'' ===
     299  === Explicit id === #using-explicit-id-in-heading
     300  == Subheading #sub2
     301}}}
     302}}}
     303{{{#!td style="padding: 1em;"
     304  {{{
     305  #!div
     306  = Heading =
     307  == Subheading
     308  === About ''this'' ===
     309  === Explicit id === #using-explicit-id-in-heading
     310  == Subheading #sub2
     311  }}}
     312}}}
     313
     314== Paragraphs
    63315
    64316A new text paragraph is created whenever two blocks of text are separated by one or more empty lines.
    65317
    66318A forced line break can also be inserted, using:
    67 {{{
    68 Line 1[[BR]]Line 2
    69 }}}
    70 Display:
    71 
    72 Line 1[[BR]]Line 2
    73 
    74 
    75 == Lists ==
     319||= Wiki Markup =||= Display =||
     320{{{#!td
     321  {{{
     322  Line 1[[BR]]Line 2
     323  }}}
     324  {{{
     325  Paragraph
     326  one
     327
     328  Paragraph
     329  two
     330  }}}
     331}}}
     332{{{#!td
     333  Line 1[[BR]]Line 2
     334
     335  Paragraph
     336  one
     337
     338  Paragraph
     339  two
     340}}}
     341
     342== Lists
    76343
    77344The wiki supports both ordered/numbered and unordered lists.
    78345
    79 Example:
    80 {{{
     346||= Wiki Markup =||= Display =||
     347{{{#!td
     348  {{{
     349   * Item 1
     350     * Item 1.1
     351        * Item 1.1.1   
     352        * Item 1.1.2
     353        * Item 1.1.3
     354     * Item 1.2
     355   * Item 2
     356  - items can start at the beginning of a line
     357    and they can span multiple lines
     358    - be careful though to continue the line
     359    with the appropriate indentation, otherwise
     360  that will start a new paragraph...
     361 
     362   1. Item 1
     363     a. Item 1.a
     364     a. Item 1.b
     365        i. Item 1.b.i
     366        i. Item 1.b.ii
     367   1. Item 2
     368  And numbered lists can also be restarted
     369  with an explicit number:
     370   3. Item 3
     371  }}}
     372}}}
     373{{{#!td
    81374 * Item 1
    82375   * Item 1.1
     376      * Item 1.1.1   
     377      * Item 1.1.2
     378      * Item 1.1.3
     379   * Item 1.2
    83380 * Item 2
     381- items can start at the beginning of a line
     382  and they can span multiple lines
     383  - be careful though to continue the line
     384  with the appropriate indentation, otherwise
     385that will start a new paragraph...
    84386
    85387 1. Item 1
     
    89391      i. Item 1.b.ii
    90392 1. Item 2
    91 And numbered lists can also be given an explicit number:
     393And numbered lists can also be restarted with an explicit number:
    92394 3. Item 3
    93395}}}
    94396
    95 Display:
    96  * Item 1
    97    * Item 1.1
    98  * Item 2
    99 
    100  1. Item 1
    101    a. Item 1.a
    102    a. Item 1.b
    103       i. Item 1.b.i
    104       i. Item 1.b.ii
    105  1. Item 2
    106 And numbered lists can also be given an explicit number:
    107  3. Item 3
    108 
    109 Note that there must be one or more spaces preceding the list item markers, otherwise the list will be treated as a normal paragraph.
    110 
    111 
    112 == Definition Lists ==
    113 
     397== Definition Lists
    114398
    115399The wiki also supports definition lists.
    116400
    117 Example:
    118 {{{
     401||= Wiki Markup =||= Display =||
     402{{{#!td
     403  {{{
     404   llama::
     405     some kind of mammal, with hair
     406   ppython::
     407     some kind of reptile, without hair
     408     (can you spot the typo?)
     409  }}}
     410}}}
     411{{{#!td
    119412 llama::
    120413   some kind of mammal, with hair
     
    124417}}}
    125418
    126 Display:
    127  llama::
    128    some kind of mammal, with hair
    129  ppython::
    130    some kind of reptile, without hair
    131    (can you spot the typo?)
    132 
    133419Note that you need a space in front of the defined term.
    134420
    135 
    136 == Preformatted Text ==
     421== Preformatted Text
    137422
    138423Block 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.
    139424 
    140 Example:
     425||= Wiki Markup =||= Display =||
     426{{{#!td
     427  {{{
     428  {{{
     429  def HelloWorld():
     430      print '''Hello World'''
     431  }}}
     432  }}}
     433}}}
     434{{{#!td
     435  {{{
     436  def HelloWorld():
     437      print '''Hello World'''
     438  }}}
     439}}}
     440
     441Note that this kind of block is also used for selecting lines that should be processed through WikiProcessors.
     442
     443== Blockquotes
     444
     445In order to mark a paragraph as blockquote, indent that paragraph with two spaces.
     446
     447||= Wiki Markup =||= Display =||
     448{{{#!td
    141449{{{
    142  {{{
    143   def HelloWorld():
    144       print "Hello World"
    145  }}}
    146 }}}
    147 
    148 Display:
    149 {{{
    150  def HelloWorld():
    151      print "Hello World"
    152 }}}
    153 
    154 
    155 == Blockquotes ==
    156 
    157 In order to mark a paragraph as blockquote, indent that paragraph with two spaces.
    158 
    159 Example:
    160 {{{
     450Paragraph
    161451  This text is a quote from someone else.
    162452}}}
    163 
    164 Display:
     453}}}
     454{{{#!td
     455Paragraph
    165456  This text is a quote from someone else.
    166 
    167 == Discussion Citations ==
    168 
    169 To delineate a citation in an ongoing discussion thread, such as the ticket comment area, e-mail-like citation marks (">", ">>", etc.) may be used. 
    170 
    171 Example:
    172 {{{
     457}}}
     458
     459== Discussion Citations
     460
     461To delineate a citation in an ongoing discussion thread, such as the ticket comment area, email-like citation marks (`>`, `>>`, etc.) may be used. 
     462
     463||= Wiki Markup =||= Display =||
     464{{{#!td
     465  {{{
     466  >> Someone's original text
     467  > Someone else's reply text
     468  >  - which can be any kind of Wiki markup
     469  My reply text
     470  }}}
     471}}}
     472{{{#!td
    173473>> Someone's original text
    174474> Someone else's reply text
     475>  - which can be any kind of Wiki markup
    175476My reply text
    176477}}}
    177478
    178 Display:
    179 >> Someone's original text
    180 > Someone else's reply text
    181 My reply text
    182 
    183 ''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.''
    184 
    185 == Tables ==
    186 
    187 Simple tables can be created like this:
    188 {{{
     479== Tables
     480=== Simple Tables
     481
     482Simple tables can be created:
     483||= Wiki Markup =||= Display =||
     484{{{#!td
     485  {{{
     486  ||Cell 1||Cell 2||Cell 3||
     487  ||Cell 4||Cell 5||Cell 6||
     488  }}}
     489}}}
     490{{{#!td style="padding: 2em;"
    189491||Cell 1||Cell 2||Cell 3||
    190492||Cell 4||Cell 5||Cell 6||
    191493}}}
    192494
    193 Display:
    194 ||Cell 1||Cell 2||Cell 3||
    195 ||Cell 4||Cell 5||Cell 6||
    196 
    197 Note that more complex tables can be created using
    198 [wiki:WikiRestructuredText#BiggerReSTExample reStructuredText].
    199 
    200 
    201 == Links ==
    202 
    203 Hyperlinks are automatically created for WikiPageNames and URLs. !WikiPageLinks can be disabled by prepending an exclamation mark "!" character, such as {{{!WikiPageLink}}}.
    204 
    205 Example:
    206 {{{
    207  TitleIndex, http://www.edgewall.com/, !NotAlink
    208 }}}
    209 
    210 Display:
    211  TitleIndex, http://www.edgewall.com/, !NotAlink
    212 
    213 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.
    214 
    215 Example:
    216 {{{
    217  * [http://www.edgewall.com/ Edgewall Software]
    218  * [wiki:TitleIndex Title Index]
    219  * [wiki:ISO9000]
    220 }}}
    221 
    222 Display:
    223  * [http://www.edgewall.com/ Edgewall Software]
    224  * [wiki:TitleIndex Title Index]
    225  * [wiki:ISO9000]
    226 
    227 
    228 === Trac Links ===
     495Cell headings can be specified by wrapping the content in a pair of `=` characters.
     496Note that the `=` characters have to stick to the cell separators:
     497||= Wiki Markup =||= Display =||
     498{{{#!td
     499  {{{
     500  ||        ||= stable =||= latest =||
     501  ||= 0.10 =||  0.10.5  || 0.10.6dev||
     502  ||= 0.11 =||  0.11.6  || 0.11.7dev||
     503  }}}
     504}}}
     505{{{#!td style="padding: 2em;"
     506||        ||= stable =||= latest =||
     507||= 0.10 =||  0.10.5  || 0.10.6dev||
     508||= 0.11 =||  0.11.6  || 0.11.7dev||
     509}}}
     510
     511Finally, specifying an empty cell means that the next non empty cell will span the empty cells:
     512||= Wiki Markup =||= Display =||
     513{{{#!td
     514  {{{
     515  || 1 || 2 || 3 ||
     516  |||| 1-2 || 3 ||
     517  || 1 |||| 2-3 ||
     518  |||||| 1-2-3 ||
     519  }}}
     520}}}
     521{{{#!td style="padding: 2em;"
     522|| 1 || 2 || 3 ||
     523|||| 1-2 || 3 ||
     524|| 1 |||| 2-3 ||
     525|||||| 1-2-3 ||
     526}}}
     527
     528Note 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:
     529||= Wiki Markup =||= Display =||
     530{{{#!td
     531  {{{
     532  ||=Text =||= Numbers =||
     533  ||left align    ||        1.0||
     534  ||  center      ||        4.5||
     535  ||      right align||     4.5||
     536  || default alignment ||   2.5||
     537  ||default||         2.5||
     538  ||  default ||      2.5||
     539  || default ||       2.5||
     540  }}}
     541}}}
     542{{{#!td style="padding: 2em;"
     543||=Text =||= Numbers =||
     544||left align    ||        1.0||
     545||  center      ||        4.5||
     546||      right align||     4.5||
     547|| default alignment ||   2.5||
     548||default||         2.5||
     549||  default ||      2.5||
     550|| default ||       2.5||
     551}}}
     552
     553If contrary to the example above, the cells in your table contain more text, it might be convenient to spread a table row over multiple lines of markup. The `\` character placed at the end of a line after a cell separator tells Trac to not start a new row for the cells on the next line:
     554
     555||= Wiki Markup =||
     556{{{#!td
     557  {{{
     558  || this is column 1 [http://trac.edgewall.org/newticket new ticket] || \
     559  || this is column 2 [http://trac.edgewall.org/roadmap the road ahead] || \
     560  || that's column 3 and last one ||
     561  }}}
     562}}}
     563|-------------
     564||= Display =||
     565{{{#!td style="padding: 2em;"
     566|| this is column 1 [http://trac.edgewall.org/newticket new ticket] || \
     567|| this is column 2 [http://trac.edgewall.org/roadmap the road ahead] || \
     568|| that's column 3 and last one ||
     569}}}
     570
     571=== Complex Tables
     572
     573If the possibilities offered by the simple pipe-based markup (`||`) for tables described above are not enough for your needs, you can create more elaborate tables by using [#Processors-example-tables WikiProcessor based tables].
     574
     575== Links
     576
     577Hyperlinks are automatically created for WikiPageNames and URLs. !WikiPageLinks can be disabled by prepending an exclamation mark (`!`), such as `!WikiPageLink`.
     578
     579||= Wiki Markup =||= Display =||
     580{{{#!td
     581  {{{
     582  TitleIndex, http://www.edgewall.com/, !NotAlink
     583  }}}
     584}}}
     585{{{#!td
     586TitleIndex, http://www.edgewall.com/, !NotAlink
     587}}}
     588
     589Links can be given a more descriptive title by writing the link followed by a space and a title and all this inside square brackets.
     590If 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.
     591
     592||= Wiki Markup =||= Display =||
     593{{{#!td
     594  {{{
     595   * [http://www.edgewall.com Edgewall Software]
     596   * [wiki:TitleIndex Title Index]
     597   * [wiki:TitleIndex]
     598   * [wiki:ISO9000]
     599  }}}
     600}}}
     601{{{#!td
     602   * [http://www.edgewall.com Edgewall Software]
     603   * [wiki:TitleIndex Title Index]
     604   * [wiki:TitleIndex]
     605   * [wiki:ISO9000]
     606}}}
     607
     608Following the [trac:WikiCreole] trend, the descriptive title can also be specified by writing the link followed by a pipe (`|`) and a title and all this inside //double// square brackets.
     609
     610{{{#!td
     611  {{{
     612   * [[http://www.edgewall.com|Edgewall Software]]
     613   * [[wiki:TitleIndex|Title Index]]
     614     or even [[TitleIndex|Title Index]]
     615   * [[wiki:TitleIndex]]
     616     ''' but not ![[TitleIndex]]! '''
     617   * [[ISO9000]]
     618  }}}
     619}}}
     620{{{#!td
     621   * [[http://www.edgewall.com|Edgewall Software]]
     622   * [[wiki:TitleIndex|Title Index]]
     623     or even [[TitleIndex|Title Index]]
     624   * [[wiki:TitleIndex]]
     625     ''' but not ![[TitleIndex]]! '''
     626   * [[ISO9000]]
     627}}}
     628
     629'''Note''': the [trac:WikiCreole] style for links is quick to type and certainly looks familiar as it is the one used on Wikipedia and in many other wikis. Unfortunately it conflicts with the syntax for [#Macros macros].
     630So in the rare case when you need to refer to a page which is named after a macro (typical examples being TitleIndex, InterTrac and InterWiki), by writing `[[TitleIndex]]` you will actually call the macro instead of linking to the page.
     631
     632== Trac Links
    229633
    230634Wiki 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:
    231 {{{
    232  * Tickets: #1 or ticket:1
    233  * Reports: {1} or report:1
    234  * Changesets: r1, [1] or changeset:1
    235  * ...
    236 }}}
    237 
    238 Display:
     635
     636||= Wiki Markup =||= Display =||
     637{{{#!td
     638  {{{
     639   * Tickets: #1 or ticket:1
     640   * Reports: {1} or report:1
     641   * Changesets: r1, [1] or changeset:1
     642   * ...
     643   * targeting other Trac instances,
     644     so called InterTrac links:
     645     - Tickets: #Trac1 or Trac:ticket:1
     646     - Changesets: [Trac1] or Trac:changeset:1
     647  }}}
     648}}}
     649{{{#!td
    239650 * Tickets: #1 or ticket:1
    240651 * Reports: {1} or report:1
    241652 * Changesets: r1, [1] or changeset:1
    242653 * ...
    243 
    244 See TracLinks for more in-depth information.
    245 
    246 
    247 == Escaping Links and WikiPageNames ==
    248 
    249 You may avoid making hyperlinks out of TracLinks by preceding an expression with a single "!" (exclamation mark).
    250 
    251 Example:
     654 * targeting other Trac instances,
     655   so called InterTrac links:
     656   - Tickets: #Trac1 or Trac:ticket:1
     657   - Changesets: [Trac1] or Trac:changeset:1
     658}}}
     659
     660There are many more flavors of Trac links, see TracLinks for more in-depth information and a reference for all the default link resolvers.
     661
     662== Setting Anchors
     663
     664An anchor, or more correctly speaking, an [http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2.1 anchor name] can be added explicitly at any place in the Wiki page, to uniquely identify a position in the document:
     665
    252666{{{
     667[=#point1]
     668}}}
     669
     670This syntax was chosen to match the format for explicitly naming the header id [#Headings documented above]:
     671{{{
     672== Long title == #title
     673}}}
     674
     675It is also very close to the syntax for the corresponding link to that anchor:
     676{{{
     677[#point1]
     678}}}
     679
     680Optionally, a label can be given to the anchor:
     681{{{
     682[=#point1 '''Point 1''']
     683}}}
     684
     685||= Wiki Markup =||= Display =||
     686|----------------------------------
     687{{{#!td
     688  {{{
     689  [#point2 jump to the second point]
     690
     691  ...
     692
     693  Point2:  [=#point2] Jump here
     694  }}}
     695}}}
     696{{{#!td
     697  [#point2 jump to the second point]
     698
     699  ...
     700
     701  Point2:  [=#point2] Jump here
     702}}}
     703
     704For more complex anchors (eg when a custom title is wanted), you can use the Span macro: `[[span(id=point2, class=wikianchor, title=Point 2, ^(2)^)]]`.
     705
     706== Escaping Links, WikiPageNames and other Markup == #Escaping
     707
     708You may avoid making hyperlinks out of TracLinks by preceding an expression with a single exclamation mark (`!`).
     709
     710||= Wiki Markup =||= Display =||
     711{{{#!td
     712  {{{
     713   !NoHyperLink
     714   !#42 is not a link
     715  }}}
     716  {{{
     717Various forms of escaping for list markup:
     718 ^^- escaped minus sign \\
     719 ^^1. escaped number  \\
     720 ^^* escaped asterisk sign
     721  }}}
     722}}}
     723{{{#!td
    253724 !NoHyperLink
    254725 !#42 is not a link
    255 }}}
    256 
    257 Display:
    258  !NoHyperLink
    259  !#42 is not a link
    260 
    261 
    262 == Images ==
     726
     727Various forms of escaping for list markup:
     728 ^^- escaped minus sign \\
     729 ^^1. escaped number  \\
     730 ^^* escaped asterisk sign
     731}}}
     732
     733== Images
    263734
    264735Urls ending with `.png`, `.gif` or `.jpg` are no longer automatically interpreted as image links, and converted to `<img>` tags.
    265736
    266 You now have to use the ![[Image]] macro (see below).
    267 
    268 
    269 == Macros ==
    270 
    271 Macros are ''custom functions'' to insert dynamic content in a page.
    272 
    273 Example:
    274 {{{
    275  [[Timestamp]]
    276 }}}
    277 
    278 Display:
    279  [[Timestamp]]
     737You 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)]]`.
     738
     739In addition to the current page, it is possible to refer to other resources:
     740 * `[[Image(wiki:WikiFormatting:picture.gif)]]` (referring to attachment on another page)
     741 * `[[Image(ticket:1:picture.gif)]]` (file attached to a ticket)
     742 * `[[Image(htdocs:picture.gif)]]` (referring to a file inside the [TracEnvironment environment] `htdocs` directory)
     743 * `[[Image(source:/trunk/trac/htdocs/trac_logo_mini.png)]]` (a file in repository)
     744
     745||= Wiki Markup =||= Display =||
     746{{{#!td
     747  {{{
     748  [[Image(htdocs:../common/trac_logo_mini.png)]]
     749  }}}
     750}}}
     751{{{#!td
     752[[Image(htdocs:../common/trac_logo_mini.png)]]
     753}}}
     754
     755See WikiMacros for further documentation on the `[[Image()]]` macro, which has several useful options (`title=`, `link=`, etc.)
     756
     757== Macros
     758
     759Macros are ''custom functions'' that insert dynamic content in a page.
     760
     761||= Wiki Markup =||= Display =||
     762{{{#!td
     763  {{{
     764  [[RecentChanges(Trac,3)]]
     765  }}}
     766}}}
     767{{{#!td style="padding-left: 2em"
     768[[RecentChanges(Trac,3)]]
     769}}}
    280770
    281771See WikiMacros for more information, and a list of installed macros.
    282772
    283 
    284 == Processors ==
     773The detailed help for a specific macro can also be obtained more directly by appending a `?` to the macro name.
     774
     775||= Wiki Markup =||= Display =||
     776{{{#!td
     777  {{{
     778  [[MacroList?]]
     779  }}}
     780}}}
     781{{{#!td style="padding-left: 2em"
     782[[MacroList?]]
     783}}}
     784
     785== Processors
    285786
    286787Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in
    287788[wiki:WikiRestructuredText reStructuredText] or [wiki:WikiHtml HTML].
    288789
    289 Example 1:
    290 {{{
    291 #!html
    292 <pre class="wiki">{{{
    293 #!html
    294 &lt;h1 style="text-align: right; color: blue"&gt;HTML Test&lt;/h1&gt;
    295 }}}</pre>
    296 }}}
    297 
    298 Display:
    299 {{{
    300 #!html
     790||= Wiki Markup =||= Display =||
     791|--------------------------------------------------------
     792{{{#!td align="center" colspan=2 style="border: 0px; font-size: 90%"
     793
     794   [=#Processors-example-html Example 1:] HTML
     795
     796}}}
     797|--------------------------------------------------------
     798{{{#!td style="border: 0px"
     799  {{{
     800  {{{#!html
     801  <h1 style="text-align: right; color: blue">
     802   HTML Test
     803  </h1>
     804  }}}
     805  }}}
     806}}}
     807{{{#!td valign="top"  style="border: 0px"
     808
     809{{{#!html
    301810<h1 style="text-align: right; color: blue">HTML Test</h1>
    302811}}}
    303812
    304 Example:
    305 {{{
    306 #!html
    307 <pre class="wiki">{{{
    308 #!python
    309 class Test:
    310 
    311     def __init__(self):
    312         print "Hello World"
    313 if __name__ == '__main__':
    314    Test()
    315 }}}</pre>
    316 }}}
    317 
    318 Display:
    319 {{{
    320 #!python
     813}}}
     814|--------------------------------------------------------
     815{{{#!td align="center" colspan=2 style="border: 0px; font-size: 90%"
     816
     817   [=#Processors-example-highlight Example 2:] Code Highlighting
     818
     819}}}
     820|--------------------------------------------------------
     821{{{#!td style="border: 0px"
     822  {{{
     823  {{{#!python
     824  class Test:
     825 
     826      def __init__(self):
     827          print "Hello World"
     828  if __name__ == '__main__':
     829     Test()
     830  }}}
     831  }}}
     832}}}
     833{{{#!td valign="top"  style="border: 0px"
     834
     835{{{#!python
    321836class Test:
    322837    def __init__(self):
     
    326841}}}
    327842
    328 Perl:
    329 {{{
    330 #!perl
    331 my ($test) = 0;
    332 if ($test > 0) {
    333     print "hello";
    334 }
     843}}}
     844|--------------------------------------------------------
     845{{{#!td align="center" colspan=2 style="border: 0px; font-size: 90%"
     846
     847       [=#Processors-example-tables Example 3:] Complex Tables
     848
     849}}}
     850|--------------------------------------------------------
     851{{{#!td style="border: 0px"
     852  {{{
     853  {{{#!th rowspan=4 align=justify
     854  With the `#td` and `#th` processors,
     855  table cells can contain any content:
     856  }}}
     857  |----------------
     858  {{{#!td
     859    - lists
     860    - embedded tables
     861    - simple multiline content
     862  }}}
     863  |----------------
     864  {{{#!td
     865  As processors can be easily nested,
     866  so can be tables:
     867    {{{#!th
     868    Example:
     869    }}}
     870    {{{#!td style="background: #eef"
     871    || must be at the third level now... ||
     872    }}}
     873  }}}
     874  |----------------
     875  {{{#!td
     876  Even when you don't have complex markup,
     877  this form of table cells can be convenient
     878  to write content on multiple lines.
     879  }}}
     880  }}}
     881}}}
     882{{{#!td  valign="top"  style="border: 0px"
     883
     884  {{{#!th rowspan=4 align=justify
     885  With the `#td` and `#th` processors,
     886  table cells can contain any content:
     887  }}}
     888  |----------------
     889  {{{#!td
     890    - lists
     891    - embedded tables
     892    - simple multiline content
     893  }}}
     894  |----------------
     895  {{{#!td
     896  As processors can be easily nested,
     897  so can be tables:
     898    {{{#!th
     899    Example:
     900    }}}
     901    {{{#!td style="background: #eef"
     902    || must be at the third level now... ||
     903    }}}
     904  }}}
     905  |----------------
     906  {{{#!td
     907  Even when you don't have complex markup,
     908  this form of table cells can be convenient
     909  to write content on multiple lines.
     910  }}}
     911
    335912}}}
    336913
    337914See WikiProcessors for more information.
    338915
    339 
    340 == Miscellaneous ==
    341 
    342 Four or more dashes will be replaced by a horizontal line (<HR>)
    343 
    344 Example:
    345 {{{
    346  ----
    347 }}}
    348 
    349 Display:
     916== Comments
     917
     918Comments can be added to the plain text. These will not be rendered and will not display in any other format than plain text.
     919
     920||= Wiki Markup =||= Display =||
     921{{{#!td
     922  {{{
     923  Nothing to
     924  {{{#!comment
     925  Your comment for editors here
     926  }}}
     927  see.
     928  }}}
     929}}}
     930{{{#!td
     931  Nothing to
     932  {{{#!comment
     933  Your comment for editors here
     934  }}}
     935  see.
     936}}}
     937
     938== Miscellaneous
     939
     940||= Wiki Markup =||= Display =||
     941{{{#!td
     942  Horizontal line:
     943  {{{
     944  Four or more dashes will be replaced
     945  by a horizontal line (<HR>)
     946  ----
     947  See?
     948  }}}
     949}}}
     950{{{#!td
     951Four or more dashes will be replaced
     952by a horizontal line (<HR>)
    350953----
    351 
    352 
    353 ----
    354 See also: TracLinks, TracGuide, WikiHtml, WikiMacros, WikiProcessors, TracSyntaxColoring.
     954See?
     955}}}
     956|----------------------------------
     957{{{#!td
     958  Two examples of line breaks:
     959  {{{
     960  "macro" style [[BR]] line break
     961  }}}
     962  or:
     963  {{{
     964  !WikiCreole style \\ line\\break
     965  }}}
     966}}}
     967{{{#!td
     968"macro" style [[BR]] line break
     969
     970!WikiCreole style \\ line\\break
     971}}}
     972|----------------------------------