Changes between Version 3 and Version 4 of WikiFormatting


Ignore:
Timestamp:
Jan 13, 2020, 11:38:50 PM (5 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiFormatting

    v3 v4  
    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://moinmo.in/ MoinMoin] and [trac:WikiCreole].
    8 
    9 
    10 This page will give you an in-depth explanation of the wiki markup available anywhere WikiFormatting is allowed.
    11 
    12 The ''Cheat sheet'' below gives you a quick overview for the most common syntax, each link in the ''Category'' column will lead you to the more detailed explanation later in this page.
    13 
    14 A few other wiki pages present the advanced features of the Trac wiki markup in more depth:
    15  - TracLinks covers all the possible ways to refer precisely to any Trac resource or parts thereof,
    16  - WikiPageNames talks about the various names a wiki page can take, CamelCase or not
    17  - WikiMacros lists the macros available for generating dynamic content,
    18  - WikiProcessors and WikiHtml details how parts of the wiki text can be processed in special ways
    19 
    20 
    21 == Cheat sheet ==
     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
    2219
    2320||= '''Category''' =||= '''Wiki Markup''' =||= '''Display''' =||
     
    2825|| `'''bold'''`, `''italic''`, `'''''Wikipedia style'''''` || \
    2926|| '''bold''', ''italic'', '''''Wikipedia style''''' ||
     27|| `**bold**`, `//italic//`, `**//!WikiCreole style//**` || \
     28|| **bold**, //italic//, **//!WikiCreole style//** ||
    3029|| {{{`monospaced (''other markup ignored'')`}}} || \
    3130|| `monospaced (''other markup ignored'')` ||
    32 || `**bold**`, `//italic//`, `**//!WikiCreole style//**` || \
    33 || **bold**, //italic//, **//!WikiCreole style//** ||
    3431|-----------------------------------------------------------
    3532||= [#Headings Headings] =||\
    3633{{{#!td
    3734 {{{
    38  == Level 2 ==
     35 == Level 2
    3936 === Level 3 ^([#hn note])^
    4037 }}}
    4138}}}
    4239{{{#!td style="padding-left: 2em"
    43 == Level 2 ==
     40== Level 2
    4441=== Level 3 ^([#hn note])^
    4542}}}
     
    6461{{{#!td
    6562 {{{
    66  * bullets list
     63 * bullet list
    6764   on multiple lines
    6865   1. nested list
     
    7269}}}
    7370{{{#!td
    74 * bullets list
     71* bullet list
    7572  on multiple lines
    7673  1. nested list
     
    9794 {{{
    9895 {{{
    99  multiple lines, ''no wiki''
     96 multiple lines, ''no wiki'',
    10097       white space respected
    10198 }}}
     
    104101{{{#!td
    105102 {{{
    106  multiple lines, ''no wiki''
     103 multiple lines, ''no wiki'',
    107104       white space respected
    108105 }}}
     
    160157|| `#1 (ticket)`, `[1] (changeset)`, `{1} (report)` ||\
    161158|| #1 (ticket), [1] (changeset), {1} (report) ||
    162 || `ticket:1, ticket:1#comment:1` ||\
    163 || ticket:1, ticket:1#comment:1 ||
     159|| `ticket:1, ticket:1#comment:1, comment:1:ticket:1` ||\
     160|| ticket:1, ticket:1#comment:1, comment:1:ticket:1 ||
    164161|| `Ticket [ticket:1]`, `[ticket:1 ticket one]` ||\
    165162|| Ticket [ticket:1], [ticket:1 ticket one] ||
     
    182179|| `!wiki:WikiFormatting`, `!WikiFormatting` ||\
    183180|| !wiki:WikiFormatting, !WikiFormatting ||
    184 || {{{`}}}`{{{-}}}`{{{`}}}` triple curly brackets` ||\
     181|| [[html(<code>`{{{-}}}` triple curly brackets</code>)]] ||\
    185182|| `{{{-}}}` triple curly brackets ||
    186183|-----------------------------------------------------------
     
    196193{{{#!td
    197194 {{{
    198  {{{
    199  #!div style="font-size: 80%"
     195 {{{#!div style="font-size: 80%"
    200196 Code highlighting:
    201197   {{{#!python
     
    206202}}}
    207203{{{#!td style="padding-left: 2em"
    208  {{{
    209  #!div style="font-size: 80%"
     204 {{{#!div style="font-size: 80%"
    210205 Code highlighting:
    211206   {{{#!python
     
    223218 }}}
    224219}}}
    225 {{{#!td style="padding-left: 2em"
    226  {{{#!comment
    227  Note to Editors: ...
    228  }}}
    229 }}}
     220||  ''(comment is shown in edit mode only)''  ||
    230221|-----------------------------------------------------------
    231222||= [#Miscellaneous Miscellaneous] =||\
     
    243234}}}
    244235
    245 
    246 == Font Styles ==
     236== Font Styles
    247237
    248238The Trac wiki supports the following font styles:
     
    264254   * **also bold**, //italic as well//,
    265255     and **'' bold italic **'' //(since 0.12)//
     256   * [[span(style=color: #FF0000, a red text )]]
    266257  }}}
    267258}}}
     
    281272 * **also bold**, //italic as well//,
    282273   and **'' bold italic **'' //(since 0.12)//
     274 * [[span(style=color: #FF0000, a red text )]]
    283275}}}
    284276
    285277Notes:
    286278 * `{{{...}}}` 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.
    287  * {{{ ! }}} 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.
     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.
    288280 * all the font styles marks have to be used in opening/closing pairs,
    289    and they must nest properly (in particular, an `''` italic can't be paired
    290    with a `//` one, and `'''` can't be paired with `**`)
    291 
    292 
    293 == Headings ==
    294 
    295 You can create heading by starting a line with one up to six ''equal'' characters ("=")
    296 followed by a single space and the headline text.
     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.
    297287
    298288[=#hn]
    299 The headline text can be followed by the same number of "=" characters, but this is no longer mandatory.
     289The headline text can be followed by the same number of `=` characters, but this is not mandatory. That is, `=== Section3 ===` is identical to `=== Section3`.
    300290
    301291Finally, the heading might optionally be followed by an explicit id. If not, an implicit but nevertheless readable id will be generated.
     
    322312}}}
    323313
    324 == Paragraphs ==
     314== Paragraphs
    325315
    326316A new text paragraph is created whenever two blocks of text are separated by one or more empty lines.
     
    350340}}}
    351341
    352 == Lists ==
     342== Lists
    353343
    354344The wiki supports both ordered/numbered and unordered lists.
    355345
    356 Example:
    357346||= Wiki Markup =||= Display =||
    358347{{{#!td
     
    406395}}}
    407396
    408 
    409 == Definition Lists ==
     397== Definition Lists
    410398
    411399The wiki also supports definition lists.
     
    431419Note that you need a space in front of the defined term.
    432420
    433 
    434 == Preformatted Text ==
     421== Preformatted Text
    435422
    436423Block 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.
     
    454441Note that this kind of block is also used for selecting lines that should be processed through WikiProcessors.
    455442
    456 == Blockquotes ==
     443== Blockquotes
    457444
    458445In order to mark a paragraph as blockquote, indent that paragraph with two spaces.
     
    470457}}}
    471458
    472 == Discussion Citations ==
    473 
    474 To delineate a citation in an ongoing discussion thread, such as the ticket comment area, e-mail-like citation marks (">", ">>", etc.) may be used. 
     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. 
    475462
    476463||= Wiki Markup =||= Display =||
     
    490477}}}
    491478
    492 
    493 == Tables ==
    494 === Simple Tables ===
    495 Simple tables can be created like this:
     479== Tables
     480=== Simple Tables
     481
     482Simple tables can be created:
    496483||= Wiki Markup =||= Display =||
    497484{{{#!td
     
    506493}}}
    507494
    508 Cell headings can be specified by wrapping the content in a pair of '=' characters.
    509 Note that the '=' characters have to stick to the cell separators, like this:
     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:
    510497||= Wiki Markup =||= Display =||
    511498{{{#!td
     
    522509}}}
    523510
    524 Finally, specifying an empty cell means that the next non empty cell will span the empty cells. For example:
     511Finally, specifying an empty cell means that the next non empty cell will span the empty cells:
    525512||= Wiki Markup =||= Display =||
    526513{{{#!td
     
    539526}}}
    540527
    541 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:
     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:
    542529||= Wiki Markup =||= Display =||
    543530{{{#!td
     
    564551}}}
    565552
    566 If 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.
     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:
    567554
    568555||= Wiki Markup =||
     
    582569}}}
    583570
    584 === Complex Tables ===
    585 
    586 If the possibilities offered by the simple "pipe"-based markup for tables described above are not enough for your needs, you can create more elaborated tables by using [#Processors-example-tables WikiProcessor based tables].
    587 
    588 
    589 == Links ==
    590 
    591 Hyperlinks are automatically created for WikiPageNames and URLs. !WikiPageLinks can be disabled by prepending an exclamation mark "!" character, such as {{{!WikiPageLink}}}.
     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`.
    592578
    593579||= Wiki Markup =||= Display =||
     
    620606}}}
    621607
    622 Following 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.
     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.
    623609
    624610{{{#!td
     
    641627}}}
    642628
    643 '''Note''': the [trac:WikiCreole] style for links is quick to type and
    644 certainly looks familiar as it's the one used on Wikipedia and in many
    645 other wikis. Unfortunately it conflicts with the syntax for [#Macros macros].
    646 So in the rare case when you need to refer to a page which is named after
    647 a macro (typical examples being TitleIndex, InterTrac and InterWiki),
    648 by writing `[[TitleIndex]]` you will actually call the macro instead of linking
    649 to the page.
    650 
    651 == Trac Links ==
     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
    652633
    653634Wiki 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:
     
    679660There are many more flavors of Trac links, see TracLinks for more in-depth information and a reference for all the default link resolvers.
    680661
    681 
    682 == Setting Anchors ==
    683 
    684 An 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, in order to uniquely identify a position in the document:
     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:
    685665
    686666{{{
     
    688668}}}
    689669
    690 This syntax was chosen to match the format for explicitly naming the header id [#Headings documented above]. For example:
     670This syntax was chosen to match the format for explicitly naming the header id [#Headings documented above]:
    691671{{{
    692672== Long title == #title
    693673}}}
    694674
    695 It's also very close to the syntax for the corresponding link to that anchor:
     675It is also very close to the syntax for the corresponding link to that anchor:
    696676{{{
    697677[#point1]
     
    700680Optionally, a label can be given to the anchor:
    701681{{{
    702 [[=#point1 '''Point 1''']]
     682[=#point1 '''Point 1''']
    703683}}}
    704684
     
    722702}}}
    723703
    724 For more complex anchors (e.g. when a custom title is wanted), one can use the Span macro, e.g. `[[span(id=point2, class=wikianchor, title=Point 2, ^(2)^)]]`.
    725 
     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)^)]]`.
    726705
    727706== Escaping Links, WikiPageNames and other Markup == #Escaping
    728707
    729 You may avoid making hyperlinks out of TracLinks by preceding an expression with a single "!" (exclamation mark).
     708You may avoid making hyperlinks out of TracLinks by preceding an expression with a single exclamation mark (`!`).
    730709
    731710||= Wiki Markup =||= Display =||
     
    737716  {{{
    738717Various forms of escaping for list markup:
    739  `-` escaped minus sign \\
    740  ``1. escaped number  \\
    741  {{{*}}} escaped asterisk sign
     718 ^^- escaped minus sign \\
     719 ^^1. escaped number  \\
     720 ^^* escaped asterisk sign
    742721  }}}
    743722}}}
     
    747726
    748727Various forms of escaping for list markup:
    749  `-` escaped minus sign \\
    750  ``1. escaped number  \\
    751  {{{*}}} escaped asterisk sign
    752 }}}
    753 
    754 == Images ==
     728 ^^- escaped minus sign \\
     729 ^^1. escaped number  \\
     730 ^^* escaped asterisk sign
     731}}}
     732
     733== Images
    755734
    756735Urls ending with `.png`, `.gif` or `.jpg` are no longer automatically interpreted as image links, and converted to `<img>` tags.
     
    776755See WikiMacros for further documentation on the `[[Image()]]` macro, which has several useful options (`title=`, `link=`, etc.)
    777756
    778 
    779 == Macros ==
    780 
    781 Macros are ''custom functions'' to insert dynamic content in a page.
     757== Macros
     758
     759Macros are ''custom functions'' that insert dynamic content in a page.
    782760
    783761||= Wiki Markup =||= Display =||
     
    793771See WikiMacros for more information, and a list of installed macros.
    794772
    795 The detailed help for a specific macro can also be obtained more directly by appending a "?" to the macro name.
     773The detailed help for a specific macro can also be obtained more directly by appending a `?` to the macro name.
    796774
    797775||= Wiki Markup =||= Display =||
     
    805783}}}
    806784
    807 
    808 == Processors ==
     785== Processors
    809786
    810787Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in
     
    821798{{{#!td style="border: 0px"
    822799  {{{
    823   {{{
    824   #!html
     800  {{{#!html
    825801  <h1 style="text-align: right; color: blue">
    826802   HTML Test
     
    831807{{{#!td valign="top"  style="border: 0px"
    832808
    833 {{{
    834 #!html
     809{{{#!html
    835810<h1 style="text-align: right; color: blue">HTML Test</h1>
    836811}}}
     
    846821{{{#!td style="border: 0px"
    847822  {{{
    848   {{{
    849   #!python
     823  {{{#!python
    850824  class Test:
    851825 
     
    857831  }}}
    858832}}}
    859 {{{
    860 #!td valign="top"  style="border: 0px"
    861 
    862 {{{
    863 #!python
     833{{{#!td valign="top"  style="border: 0px"
     834
     835{{{#!python
    864836class Test:
    865837    def __init__(self):
     
    908880  }}}
    909881}}}
    910 {{{
    911 #!td  valign="top"  style="border: 0px"
     882{{{#!td  valign="top"  style="border: 0px"
    912883
    913884  {{{#!th rowspan=4 align=justify
     
    943914See WikiProcessors for more information.
    944915
    945 
    946 == Comments ==
     916== Comments
    947917
    948918Comments can be added to the plain text. These will not be rendered and will not display in any other format than plain text.
     
    952922  {{{
    953923  Nothing to
    954   {{{
    955   #!comment
     924  {{{#!comment
    956925  Your comment for editors here
    957926  }}}
    958   see ;-)
     927  see.
    959928  }}}
    960929}}}
    961930{{{#!td
    962931  Nothing to
    963   {{{
    964   #!comment
     932  {{{#!comment
    965933  Your comment for editors here
    966934  }}}
    967   see ;-)
    968 }}}
    969 
    970 == Miscellaneous ==
    971 
    972 An horizontal line can be used to separated different parts of your page:
    973 
    974 ||= Wiki Markup =||= Display =||
    975 {{{#!td
     935  see.
     936}}}
     937
     938== Miscellaneous
     939
     940||= Wiki Markup =||= Display =||
     941{{{#!td
     942  Horizontal line:
    976943  {{{
    977944  Four or more dashes will be replaced
    978   by an horizontal line (<HR>)
     945  by a horizontal line (<HR>)
    979946  ----
    980947  See?
     
    983950{{{#!td
    984951Four or more dashes will be replaced
    985 by an horizontal line (<HR>)
     952by a horizontal line (<HR>)
    986953----
    987954See?
     
    989956|----------------------------------
    990957{{{#!td
    991   {{{
    992   "macro" style [[br]] line break
    993   }}}
    994 }}}
    995 {{{#!td
    996 "macro" style [[br]] line break
     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
    997971}}}
    998972|----------------------------------
    999 {{{#!td
    1000   {{{
    1001   !WikiCreole style \\ line\\break
    1002   }}}
    1003 }}}
    1004 {{{#!td
    1005 !WikiCreole style \\ line\\break
    1006 }}}
    1007