block with custom style
}}}
|-----------------------------------------------------------------
{{{#!td style="border: none"
{{{
{{{#!div style="background: #ffd; border: 3px ridge"
This is an example of embedded "code" block:
{{{
#!python
def hello():
return "world"
}}}
}}}
}}}
}}}
{{{#!td valign=top style="border: none; padding: 1em"
{{{#!div style="background: #ffd; border: 3px ridge"
This is an example of embedded "code" block:
{{{
#!python
def hello():
return "world"
}}}
}}}
}}}
Note already at this point that HTML blocks have to be self-contained,
i.e. you can't start an HTML element in one block and close it later in a second block. Use [#element element] processors for achieving a similar effect.
More details on this in WikiHtml.
== Available Processors ==
The following processors are included in the Trac distribution:
`#!default` :: Present the text verbatim in a preformatted text block.
This is the same as specifying ''no'' processor name
(and no `#!`)
`#!comment` :: Do not process the text in this section (i.e. contents exist
only in the plain text - not in the rendered page).
=== HTML related ===
`#!html` :: Insert custom HTML in a wiki page.
`#!htmlcomment` :: Insert an HTML comment in a wiki page (''since 0.12'').
`#!div` :: Wrap an arbitrary Wiki content inside a
element
(''since 0.11'').
`#!span` :: Wrap an arbitrary Wiki content inside a element
(''since 0.11'').
`#!td` :: Wrap an arbitrary Wiki content inside a
element (''since 0.12'')
`#!th` :: Wrap an arbitrary Wiki content inside a | element (''since 0.12'')
`#!tr` :: Can optionally be used for wrapping `#!td` and `#!th` blocks,
either for specifying row attributes of better visual grouping
(''since 0.12'')
See WikiHtml for more details about these processors.
=== Other Markups ===
`#!rst` :: Trac support for Restructured Text. See WikiRestructuredText.
`#!textile` :: Supported if [http://cheeseshop.python.org/pypi/textile Textile]
is installed.
See [http://www.textism.com/tools/textile/ a Textile reference].
=== Code Highlighting Support ===
Trac includes processors to provide inline syntax highlighting:
`#!c` (C), `#!cpp` (C++), `#!python` (Python), `#!perl` (Perl),
`#!ruby` (Ruby), `#!php` (PHP), `#!asp` (ASP), `#!java` (Java),
`#!js` (Javascript), `#!sql (SQL)`, `#!xml` (XML or highlighted HTML),
`#!sh` (Bourne/Bash shell), etc.
Trac relies on external software packages for syntax coloring,
like [http://pygments.org Pygments].
See TracSyntaxColoring for informations about which languages
are supported and how to enable support for more languages.
Note also that by using the MIME type as processor, it is possible to syntax-highlight the same languages that are supported when browsing source code. For example, you can write:
{{{
{{{
#!text/html
text
}}}
}}}
The result will be syntax highlighted HTML code:
{{{
#!text/html
text
}}}
The same is valid for all other mime types supported.
=== Additional Processors ===
For more processor macros developed and/or contributed by users, visit:
* [trac:ProcessorBazaar]
* [trac:MacroBazaar]
* [th:WikiStart Trac Hacks] community site
Developing processors is no different from Wiki macros.
In fact they work the same way, only the usage syntax differs.
See WikiMacros#DevelopingCustomMacros for more information.
----
See also: WikiMacros, WikiHtml, WikiRestructuredText, TracSyntaxColoring, WikiFormatting, TracGuide |