Changes between Version 1 and Version 2 of WikiHtml


Ignore:
Timestamp:
Dec 25, 2018, 9:20:53 PM (6 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiHtml

    v1 v2  
    1 = Using HTML in Wiki Text =
     1= Using HTML in Wiki Text
    22
    33Trac supports the display of HTML in any wiki context, by using the `#!html` [wiki:WikiProcessors WikiProcessor].
     
    66In particular, you can't insert a start tag in an `#!html` block, resume normal wiki text and insert the corresponding end tag in a second `#!html` block.
    77
    8 Fortunately, for creating styled <div>s, <span>s  or even complex tables containing arbitrary Wiki text, there is a powerful alternative: `#!div`, `#!span` and `#!table`, `#!tr`, `#!td` and `#!th` blocks. Those Wiki processors are built-in and do not require additional packages to be installed.
    9 
    10 == How to use `#!html` == #HowtoUseHTML
     8For creating styled `<div>`s, `<span>`s  or even complex tables containing arbitrary Wiki text, there is a powerful alternative: `#!div`, `#!span` and `#!table`, `#!tr`, `#!td` and `#!th` blocks. Those Wiki processors are built-in and do not require additional packages to be installed.
     9
     10== How to use `#!html` #HowtoUseHTML
    1111To inform the wiki engine that a block of text should be treated as HTML, use the ''html'' processor:
    1212
     
    1414{{{#!td
    1515  {{{
    16   {{{
    17   #!html
     16  {{{#!html
    1817  <h1 style="text-align: right; color: blue">HTML Test</h1>
    1918  }}}
     
    2120}}}
    2221{{{#!td style="padding-left: 2em"
    23   {{{
    24   #!html
     22  {{{#!html
    2523  <h1 style="text-align: right; color: blue">HTML Test</h1>
    2624  }}}
     
    2927Note that Trac sanitizes your HTML code before displaying it. That means that potentially dangerous constructs, such as Javascript event handlers, will be removed from the output.
    3028
    31 The filtering is done by [http://genshi.edgewall.org/ Genshi] and the output will be a well-formed fragment of HTML. This means that you can no longer use two HTML blocks, one for opening a <div> and another for closing it, in order to wrap arbitrary wiki text.
    32 The new way to wrap any wiki content inside a <div> is to use the `#!div` Wiki processor.
     29The filtering is done by [http://genshi.edgewall.org/ Genshi] and the output will be a well-formed fragment of HTML. This means that you cannot use two HTML blocks, one for opening a <div> and another for closing it, in order to wrap arbitrary wiki text.
    3330
    3431== How to use `#!div` and `#!span` == #HowtoUseDivSpan
     
    3734{{{#!td
    3835  {{{
    39   {{{
    40   #!div class="important"
     36  {{{#!div class="important"
    4137  **important** is a predefined class.
    4238  }}}
    4339  }}}
    4440  {{{
    45   {{{
    46   #!div style="border: 1pt dotted; margin: 1em"
     41  {{{#!div style="border: 1pt dotted; margin: 1em"
    4742  **wikipage** is another predefined class that will
    4843  be used when no class is specified.
     
    5045  }}}
    5146  {{{
    52   {{{
    53   #!div class="compact" style="border: 1pt dotted; margin: 1em"
     47  {{{#!div class="compact" style="border: 1pt dotted; margin: 1em"
    5448  **compact** is another predefined class reducing
    5549  the padding within the `<div>` to a minimum.
     
    5751  }}}
    5852  {{{
    59   {{{
    60   #!div class="wikipage compact" style="border: 1pt dotted"
     53  {{{#!div class="wikipage compact" style="border: 1pt dotted"
    6154  Classes can be combined (here **wikipage** and **compact**)
    6255  which results in this case in reduced //vertical//
     
    6659  }}}
    6760  {{{
    68   {{{
    69   #!div class="" style="border: 1pt dotted; margin: 1em"
     61  {{{#!div class="" style="border: 1pt dotted; margin: 1em"
    7062  Explicitly specifying no classes is //not// the same
    7163  as specifying no class attribute, as this will remove
     
    7668{{{#!td style="padding-left: 2em"
    7769
    78   {{{
    79   #!div class="important"
     70  {{{#!div class="important"
    8071  **important** is a predefined class.
    8172  }}}
    8273
    83   {{{
    84   #!div style="border: 1pt dotted; margin: 1em"
     74  {{{#!div style="border: 1pt dotted; margin: 1em"
    8575  **wikipage** is another predefined class that will
    8676  be used when no class is specified.
    8777  }}}
    8878
    89   {{{
    90   #!div class="compact" style="border: 1pt dotted; margin: 1em"
     79  {{{#!div class="compact" style="border: 1pt dotted; margin: 1em"
    9180  **compact** is another predefined class reducing
    9281  the padding within the `<div>` to a minimum.
    9382  }}}
    9483
    95   {{{
    96   #!div class="wikipage compact" style="border: 1pt dotted"
     84  {{{#!div class="wikipage compact" style="border: 1pt dotted"
    9785  Classes can be combined (here **wikipage** and **compact**)
    9886  which results in this case in reduced //vertical//
     
    10189  }}}
    10290
    103   {{{
    104   #!div class="" style="border: 1pt dotted; margin: 1em"
     91  {{{#!div class="" style="border: 1pt dotted; margin: 1em"
    10592  Explicitly specifying no classes is //not// the same
    10693  as specifying no class attribute, as this will remove
     
    11097}}}
    11198
    112 Note that the contents of a `#!div` block are contained in one or more paragraphs, which have a non-zero top and bottom margin. This leads to the top and bottom padding in the example above. To remove the top and bottom margin of the content, add the `compact` class to the `#!div`. Another predefined class besides `wikipage` and `compact` is `important`, which can be used to make a paragraph stand out. Extra CSS classes can be defined via the `site/style.css` file for example, see TracInterfaceCustomization#SiteAppearance.
     99Note that the contents of a `#!div` block are contained in one or more paragraphs, which have a non-zero top and bottom margin. This leads to the top and bottom padding in the example above. To remove the top and bottom margin of the content, add the `compact` class to the `#!div`. Another predefined class besides `wikipage` and `compact` is `important`, which can be used to make a paragraph stand out. Extra CSS classes can be defined via [TracInterfaceCustomization#SiteAppearance site/style.css].
    113100
    114101For spans, you should use the Macro call syntax:
     
    127114}}}
    128115
    129 == How to use `#!td` and other table related processors == #Tables
     116== How to use `#!td` and other table related processors #Tables
    130117
    131118The `#!td` or `#!th` processors should be used to create table data and table header cells, respectively. The other processors `#!table` and `#!tr` are not required for introducing a table structure, as `#!td` and `#!th` will do this automatically. The `|-` row separator can be used to start a new row when needed, but some may prefer to use a `#!tr` block for that, as this introduces a more formal grouping and offers the possibility to use an extra level of indentation. The main purpose of the `#!table` and `#!tr` is to give the possibility to specify HTML attributes, like ''style'' or ''valign'' to these elements.
     
    165152 attributes to the table itself...
    166153 
    167  {{{
    168  #!table style="border:none;text-align:center;margin:auto"
     154 {{{#!table style="border:none;text-align:center;margin:auto"
    169155   {{{#!tr ====================================
    170156     {{{#!th style="border: none"
     
    228214attributes to the table itself...
    229215
    230 {{{
    231 #!table style="border:none;text-align:center;margin:auto"
     216{{{#!table style="border:none;text-align:center;margin:auto"
    232217  {{{#!tr ====================================
    233218    {{{#!th style="border: none"
     
    303288}}}
    304289
    305 == HTML comments ==
     290== HTML comments
    306291HTML comments are stripped from the output of the `html` processor. To add an HTML comment to a wiki page, use the `htmlcomment` processor, available since Trac 0.12:
    307292||= Wiki Markup =||
    308293{{{#!td
    309294  {{{
    310   {{{
    311   #!htmlcomment
     295  {{{#!htmlcomment
    312296  This block is translated to an HTML comment.
    313297  It can contain <tags> and &entities; that will not be escaped in the output.
     
    326310}}}
    327311
    328 Please note that the character sequence "`--`" is not allowed in HTML comments, and will generate a rendering error.
    329 
    330 
    331 == More Information ==
     312The character sequence `--` is not allowed in HTML comments, and will generate a rendering error.
     313
     314
     315== More Information
    332316
    333317 * http://www.w3.org/ -- World Wide Web Consortium
     
    335319
    336320----
    337 See also:  WikiProcessors, WikiFormatting, WikiRestructuredText
     321See also:  WikiFormatting, WikiProcessors, WikiRestructuredText