Changes between Version 1 and Version 2 of WikiFormatting
- Время:
- 26 нояб. 2022 г., 14:16:01 (2 года назад)
Обозначения:
- Без изменений
- Добавлено
- Удалено
- Изменено
-
WikiFormatting
v1 v2 3 3 [[TracGuideToc]] 4 4 5 Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into a flexible and powerful whole. 6 7 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://moinmo.in/ MoinMoin] and [trac:WikiCreole]. 8 9 This page will give you an in-depth explanation of the wiki markup available anywhere WikiFormatting is allowed. 10 11 The sections below provide an overview for the most common syntax, each link in the ''Category'' column will lead you to the more detailed explanation later in this page. 12 13 A few other wiki pages present the advanced features of the Trac wiki markup in more depth: 14 - TracLinks covers all the possible ways to refer precisely to any Trac resource or parts thereof 15 - WikiPageNames covers the various names a wiki page can take, CamelCase or not 16 - WikiMacros lists the macros available for generating dynamic content 17 - WikiProcessors and WikiHtml details how parts of the wiki text can be processed in special ways 18 - [trac:wiki:TracDev/Proposals/AdvancedWikiOperations AdvancedWikiOperations] provides some operations in uncommon or administrative scenarios 5 Wiki markup is a core feature in Trac, tightly integrating all the other parts of Trac into a flexible and unified whole. 6 7 Trac has a powerful wiki rendering engine that implements a subset of the commands from other popular Wikis, such as [https://moinmo.in/ MoinMoin] and [trac:WikiCreole]. 8 9 The 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 11 The 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. 19 17 20 18 == Common wiki markup … … 27 25 || `'''bold'''`, `''italic''`, `'''''Wikipedia style'''''` || \ 28 26 || '''bold''', ''italic'', '''''Wikipedia style''''' || 27 || `**bold**`, `//italic//`, `**//!WikiCreole style//**` || \ 28 || **bold**, //italic//, **//!WikiCreole style//** || 29 29 || {{{`monospaced (''other markup ignored'')`}}} || \ 30 30 || `monospaced (''other markup ignored'')` || 31 || `**bold**`, `//italic//`, `**//!WikiCreole style//**` || \32 || **bold**, //italic//, **//!WikiCreole style//** ||33 31 |----------------------------------------------------------- 34 32 ||= [#Headings Headings] =||\ 35 {{{#!td 36 {{{ 37 == Level 2 ==33 {{{#!td 34 {{{ 35 == Level 2 38 36 === Level 3 ^([#hn note])^ 39 37 }}} 40 38 }}} 41 39 {{{#!td style="padding-left: 2em" 42 == Level 2 ==40 == Level 2 43 41 === Level 3 ^([#hn note])^ 44 42 }}} … … 63 61 {{{#!td 64 62 {{{ 65 * bullet slist63 * bullet list 66 64 on multiple lines 67 65 1. nested list 68 a. different numbering 66 a. different numbering 69 67 styles 70 68 }}} 71 69 }}} 72 70 {{{#!td 73 * bullet slist71 * bullet list 74 72 on multiple lines 75 73 1. nested list … … 96 94 {{{ 97 95 {{{ 98 multiple lines, ''no wiki'' 96 multiple lines, ''no wiki'', 99 97 white space respected 100 98 }}} … … 103 101 {{{#!td 104 102 {{{ 105 multiple lines, ''no wiki'' 103 multiple lines, ''no wiki'', 106 104 white space respected 107 105 }}} … … 147 145 [#Links Links] 148 146 }}} 149 || `http ://trac.edgewall.org` ||\150 || http ://trac.edgewall.org ||147 || `https://trac.edgewall.org` ||\ 148 || https://trac.edgewall.org || 151 149 || `WikiFormatting (CamelCase)` ||\ 152 150 || WikiFormatting (CamelCase) || … … 159 157 || `#1 (ticket)`, `[1] (changeset)`, `{1} (report)` ||\ 160 158 || #1 (ticket), [1] (changeset), {1} (report) || 161 || `ticket:1, ticket:1#comment:1 ` ||\162 || 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 || 163 161 || `Ticket [ticket:1]`, `[ticket:1 ticket one]` ||\ 164 162 || Ticket [ticket:1], [ticket:1 ticket one] || … … 166 164 || Ticket [[ticket:1]], [[ticket:1|ticket one]] || 167 165 |----------------------------------------------------------- 168 {{{#!th rowspan=2 166 {{{#!th rowspan=2 169 167 [#SettingAnchors Setting Anchors] 170 168 }}} … … 195 193 {{{#!td 196 194 {{{ 197 {{{ 198 #!div style="font-size: 80%" 195 {{{#!div style="font-size: 80%" 199 196 Code highlighting: 200 197 {{{#!python … … 205 202 }}} 206 203 {{{#!td style="padding-left: 2em" 207 {{{ 208 #!div style="font-size: 80%" 204 {{{#!div style="font-size: 80%" 209 205 Code highlighting: 210 {{{#!python 206 {{{#!python 211 207 hello = lambda: "world" 212 208 }}} … … 222 218 }}} 223 219 }}} 224 {{{#!td style="padding-left: 2em" 225 {{{#!comment 226 Note to Editors: ... 227 }}} 228 }}} 220 || ''(comment is shown in edit mode only)'' || 229 221 |----------------------------------------------------------- 230 222 ||= [#Miscellaneous Miscellaneous] =||\ 231 223 {{{#!td 232 224 {{{ 233 Line [[br]] break 225 Line [[br]] break 234 226 Line \\ break 235 227 ---- … … 248 240 {{{#!td 249 241 {{{ 250 * '''bold''', 251 ''' triple quotes !''' 252 can be bold too if prefixed by ! ''', 242 * '''bold''', 243 ''' triple quotes !''' 244 can be bold too if prefixed by ! ''', 253 245 * ''italic'' 254 246 * '''''bold italic''''' or ''italic and … … 258 250 (hence `{{{` or {{{`}}} quoting) 259 251 * ~~strike-through~~ 260 * ^superscript^ 252 * ^superscript^ 261 253 * ,,subscript,, 262 * **also bold**, //italic as well//, 254 * **also bold**, //italic as well//, 263 255 and **'' bold italic **'' //(since 0.12)// 264 256 * [[span(style=color: #FF0000, a red text )]] … … 266 258 }}} 267 259 {{{#!td 268 * '''bold''', 269 ''' triple quotes !''' 270 can be bold too if prefixed by ! ''', 260 * '''bold''', 261 ''' triple quotes !''' 262 can be bold too if prefixed by ! ''', 271 263 * ''italic'' 272 264 * '''''bold italic''''' or ''italic and … … 276 268 (hence `{{{` or {{{`}}} quoting) 277 269 * ~~strike-through~~ 278 * ^superscript^ 270 * ^superscript^ 279 271 * ,,subscript,, 280 * **also bold**, //italic as well//, 272 * **also bold**, //italic as well//, 281 273 and **'' bold italic **'' //(since 0.12)// 282 274 * [[span(style=color: #FF0000, a red text )]] … … 285 277 Notes: 286 278 * `{{{...}}}` 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.288 * 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 paired290 with a `//` one, and `'''` can't be paired with `**` )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 `**`. 291 283 292 284 == Headings 293 285 294 You can create heading by starting a line with one up to six ''equal'' characters ("=") followed by a single space and the headline text.286 You can create a heading by starting a line with one up to six ''equal'' characters (`=`) followed by a single space and the headline text. 295 287 296 288 [=#hn] 297 The headline text can be followed by the same number of "=" characters, but this is no longer mandatory.289 The headline text can be followed by the same number of `=` characters, but this is not mandatory. That is, `=== Section3 ===` is identical to `=== Section3`. 298 290 299 291 Finally, the heading might optionally be followed by an explicit id. If not, an implicit but nevertheless readable id will be generated. … … 334 326 one 335 327 336 Paragraph 328 Paragraph 337 329 two 338 330 }}} … … 341 333 Line 1[[BR]]Line 2 342 334 343 Paragraph 335 Paragraph 344 336 one 345 337 346 Paragraph 338 Paragraph 347 339 two 348 340 }}} … … 352 344 The wiki supports both ordered/numbered and unordered lists. 353 345 354 Example:355 346 ||= Wiki Markup =||= Display =|| 356 347 {{{#!td … … 358 349 * Item 1 359 350 * Item 1.1 360 * Item 1.1.1 351 * Item 1.1.1 361 352 * Item 1.1.2 362 353 * Item 1.1.3 … … 365 356 - items can start at the beginning of a line 366 357 and they can span multiple lines 367 - be careful though to continue the line 358 - be careful though to continue the line 368 359 with the appropriate indentation, otherwise 369 360 that will start a new paragraph... 370 361 371 362 1. Item 1 372 363 a. Item 1.a … … 383 374 * Item 1 384 375 * Item 1.1 385 * Item 1.1.1 376 * Item 1.1.1 386 377 * Item 1.1.2 387 378 * Item 1.1.3 … … 390 381 - items can start at the beginning of a line 391 382 and they can span multiple lines 392 - be careful though to continue the line 383 - be careful though to continue the line 393 384 with the appropriate indentation, otherwise 394 385 that will start a new paragraph... … … 431 422 432 423 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. 433 424 434 425 ||= Wiki Markup =||= Display =|| 435 426 {{{#!td … … 468 459 == Discussion Citations 469 460 470 To delineate a citation in an ongoing discussion thread, such as the ticket comment area, e -mail-like citation marks (">", ">>", etc.) may be used.461 To delineate a citation in an ongoing discussion thread, such as the ticket comment area, email-like citation marks (`>`, `>>`, etc.) may be used. 471 462 472 463 ||= Wiki Markup =||= Display =|| … … 489 480 === Simple Tables 490 481 491 Simple tables can be created like this:482 Simple tables can be created: 492 483 ||= Wiki Markup =||= Display =|| 493 484 {{{#!td … … 502 493 }}} 503 494 504 Cell headings can be specified by wrapping the content in a pair of '='characters.505 Note that the '=' characters have to stick to the cell separators, like this:495 Cell headings can be specified by wrapping the content in a pair of `=` characters. 496 Note that the `=` characters have to stick to the cell separators: 506 497 ||= Wiki Markup =||= Display =|| 507 498 {{{#!td … … 518 509 }}} 519 510 520 Finally, specifying an empty cell means that the next non empty cell will span the empty cells . For example:511 Finally, specifying an empty cell means that the next non empty cell will span the empty cells: 521 512 ||= Wiki Markup =||= Display =|| 522 513 {{{#!td … … 535 526 }}} 536 527 537 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:528 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: 538 529 ||= Wiki Markup =||= Display =|| 539 530 {{{#!td … … 560 551 }}} 561 552 562 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 .553 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: 563 554 564 555 ||= Wiki Markup =|| 565 556 {{{#!td 566 557 {{{ 567 || this is column 1 [http ://trac.edgewall.org/newticket new ticket] || \568 || this is column 2 [http ://trac.edgewall.org/roadmap the road ahead] || \558 || this is column 1 [https://trac.edgewall.org/newticket new ticket] || \ 559 || this is column 2 [https://trac.edgewall.org/roadmap the road ahead] || \ 569 560 || that's column 3 and last one || 570 561 }}} … … 573 564 ||= Display =|| 574 565 {{{#!td style="padding: 2em;" 575 || this is column 1 [http ://trac.edgewall.org/newticket new ticket] || \576 || this is column 2 [http ://trac.edgewall.org/roadmap the road ahead] || \566 || this is column 1 [https://trac.edgewall.org/newticket new ticket] || \ 567 || this is column 2 [https://trac.edgewall.org/roadmap the road ahead] || \ 577 568 || that's column 3 and last one || 578 569 }}} … … 580 571 === Complex Tables 581 572 582 If the possibilities offered by the simple "pipe"-based markup for tables described above are not enough for your needs, you can create more elaboratedtables by using [#Processors-example-tables WikiProcessor based tables].573 If 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]. 583 574 584 575 == Links 585 576 586 Hyperlinks are automatically created for WikiPageNames and URLs. !WikiPageLinks can be disabled by prepending an exclamation mark "!" character, such as {{{!WikiPageLink}}}.587 588 ||= Wiki Markup =||= Display =|| 589 {{{#!td 590 {{{ 591 TitleIndex, http ://www.edgewall.com/, !NotAlink592 }}} 593 }}} 594 {{{#!td 595 TitleIndex, http ://www.edgewall.com/, !NotAlink596 }}} 597 598 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. 577 Hyperlinks 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, https://www.edgewall.com/, !NotAlink 583 }}} 584 }}} 585 {{{#!td 586 TitleIndex, https://www.edgewall.com/, !NotAlink 587 }}} 588 589 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. 599 590 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. 600 591 … … 602 593 {{{#!td 603 594 {{{ 604 * [http ://www.edgewall.com Edgewall Software]605 * [wiki:TitleIndex Title Index] 606 * [wiki:TitleIndex] 595 * [https://www.edgewall.com Edgewall Software] 596 * [wiki:TitleIndex Title Index] 597 * [wiki:TitleIndex] 607 598 * [wiki:ISO9000] 608 599 }}} 609 600 }}} 610 601 {{{#!td 611 * [http ://www.edgewall.com Edgewall Software]612 * [wiki:TitleIndex Title Index] 613 * [wiki:TitleIndex] 602 * [https://www.edgewall.com Edgewall Software] 603 * [wiki:TitleIndex Title Index] 604 * [wiki:TitleIndex] 614 605 * [wiki:ISO9000] 615 606 }}} 616 607 617 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.618 619 {{{#!td 620 {{{ 621 * [[http ://www.edgewall.com|Edgewall Software]]608 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. 609 610 {{{#!td 611 {{{ 612 * [[https://www.edgewall.com|Edgewall Software]] 622 613 * [[wiki:TitleIndex|Title Index]] 623 614 or even [[TitleIndex|Title Index]] … … 628 619 }}} 629 620 {{{#!td 630 * [[http ://www.edgewall.com|Edgewall Software]]621 * [[https://www.edgewall.com|Edgewall Software]] 631 622 * [[wiki:TitleIndex|Title Index]] 632 623 or even [[TitleIndex|Title Index]] … … 650 641 * Changesets: r1, [1] or changeset:1 651 642 * ... 652 * targeting other Trac instances, 643 * targeting other Trac instances, 653 644 so called InterTrac links: 654 645 - Tickets: #Trac1 or Trac:ticket:1 … … 660 651 * Reports: {1} or report:1 661 652 * Changesets: r1, [1] or changeset:1 662 * ... 663 * targeting other Trac instances, 653 * ... 654 * targeting other Trac instances, 664 655 so called InterTrac links: 665 656 - Tickets: #Trac1 or Trac:ticket:1 … … 671 662 == Setting Anchors 672 663 673 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 orderto uniquely identify a position in the document:664 An anchor, or more correctly speaking, an [https://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: 674 665 675 666 {{{ … … 677 668 }}} 678 669 679 This syntax was chosen to match the format for explicitly naming the header id [#Headings documented above] . For example:670 This syntax was chosen to match the format for explicitly naming the header id [#Headings documented above]: 680 671 {{{ 681 672 == Long title == #title 682 673 }}} 683 674 684 It 's also very close to the syntax for the corresponding link to that anchor:675 It is also very close to the syntax for the corresponding link to that anchor: 685 676 {{{ 686 677 [#point1] … … 689 680 Optionally, a label can be given to the anchor: 690 681 {{{ 691 [ [=#point1 '''Point 1''']]682 [=#point1 '''Point 1'''] 692 683 }}} 693 684 … … 711 702 }}} 712 703 713 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)^)]]`.704 For 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)^)]]`. 714 705 715 706 == Escaping Links, WikiPageNames and other Markup == #Escaping 716 707 717 You may avoid making hyperlinks out of TracLinks by preceding an expression with a single "!" (exclamation mark).708 You may avoid making hyperlinks out of TracLinks by preceding an expression with a single exclamation mark (`!`). 718 709 719 710 ||= Wiki Markup =||= Display =|| … … 766 757 == Macros 767 758 768 Macros are ''custom functions'' t oinsert dynamic content in a page.759 Macros are ''custom functions'' that insert dynamic content in a page. 769 760 770 761 ||= Wiki Markup =||= Display =|| … … 780 771 See WikiMacros for more information, and a list of installed macros. 781 772 782 The detailed help for a specific macro can also be obtained more directly by appending a "?"to the macro name.773 The detailed help for a specific macro can also be obtained more directly by appending a `?` to the macro name. 783 774 784 775 ||= Wiki Markup =||= Display =|| … … 794 785 == Processors 795 786 796 Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in 797 [wiki:WikiRestructuredText reStructuredText] or [wiki:WikiHtml HTML]. 787 Trac supports alternative markup formats using WikiProcessors. For example, processors are used to write pages in 788 [wiki:WikiRestructuredText reStructuredText] or [wiki:WikiHtml HTML]. 798 789 799 790 ||= Wiki Markup =||= Display =|| … … 807 798 {{{#!td style="border: 0px" 808 799 {{{ 809 {{{ 810 #!html 800 {{{#!html 811 801 <h1 style="text-align: right; color: blue"> 812 802 HTML Test … … 817 807 {{{#!td valign="top" style="border: 0px" 818 808 819 {{{ 820 #!html 809 {{{#!html 821 810 <h1 style="text-align: right; color: blue">HTML Test</h1> 822 811 }}} … … 832 821 {{{#!td style="border: 0px" 833 822 {{{ 834 {{{ 835 #!python 823 {{{#!python 836 824 class Test: 837 825 838 826 def __init__(self): 839 827 print "Hello World" … … 843 831 }}} 844 832 }}} 845 {{{ 846 #!td valign="top" style="border: 0px" 847 848 {{{ 849 #!python 833 {{{#!td valign="top" style="border: 0px" 834 835 {{{#!python 850 836 class Test: 851 837 def __init__(self): … … 877 863 |---------------- 878 864 {{{#!td 879 As processors can be easily nested, 865 As processors can be easily nested, 880 866 so can be tables: 881 867 {{{#!th … … 894 880 }}} 895 881 }}} 896 {{{ 897 #!td valign="top" style="border: 0px" 882 {{{#!td valign="top" style="border: 0px" 898 883 899 884 {{{#!th rowspan=4 align=justify … … 909 894 |---------------- 910 895 {{{#!td 911 As processors can be easily nested, 896 As processors can be easily nested, 912 897 so can be tables: 913 898 {{{#!th … … 937 922 {{{ 938 923 Nothing to 939 {{{ 940 #!comment 924 {{{#!comment 941 925 Your comment for editors here 942 926 }}} 943 see ;-)927 see. 944 928 }}} 945 929 }}} 946 930 {{{#!td 947 931 Nothing to 948 {{{ 949 #!comment 932 {{{#!comment 950 933 Your comment for editors here 951 934 }}} 952 see ;-)935 see. 953 936 }}} 954 937 955 938 == Miscellaneous 956 939 957 An horizontal line can be used to separated different parts of your page: 958 959 ||= Wiki Markup =||= Display =|| 960 {{{#!td 961 {{{ 962 Four or more dashes will be replaced 963 by an horizontal line (<HR>) 940 ||= Wiki Markup =||= Display =|| 941 {{{#!td 942 Horizontal line: 943 {{{ 944 Four or more dashes will be replaced 945 by a horizontal line (<HR>) 964 946 ---- 965 947 See? … … 968 950 {{{#!td 969 951 Four or more dashes will be replaced 970 by a nhorizontal line (<HR>)952 by a horizontal line (<HR>) 971 953 ---- 972 954 See? … … 974 956 |---------------------------------- 975 957 {{{#!td 976 {{{ 977 "macro" style [[br]] line break 978 }}} 979 }}} 980 {{{#!td 981 "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 982 971 }}} 983 972 |---------------------------------- 984 {{{#!td985 {{{986 !WikiCreole style \\ line\\break987 }}}988 }}}989 {{{#!td990 !WikiCreole style \\ line\\break991 }}}