wiki:WikiProcessors

Version 2 (modified by joe, 19 years ago) (diff)

--

Wiki Processors

Processors are WikiMacros designed to provide alternative markup formats for the Wiki engine. Processors can be thought of as macro functions to process user-edited text.

The wiki engine uses processors to allow using raw HTML in any wiki text.

Using Processors

To use a processor on a block of text, use a wiki blockquote, selecting a processor by name using 'hashbang notation' (#!), familiar to most UNIX users from scripts.

Example 1 (inserting raw HTML in a wiki text):

{{{
#!html
<h1 style="color: orange">This is raw HTML</h1>
}}}

Results in:

This is raw HTML


Example 2 (inserting a block of C source code in wiki text):

{{{
#!c
int main(int argc, char *argv[])
{
  printf("Hello World\n");
  return 0;
}
}}}

Results in:

int main(int argc, char *argv[])
{
  printf("Hello World\n");
  return 0;
}

Available Processors

The following processors are included in the Trac distribution:

  • html -- Insert custom HTML in a wiki page. See WikiHtml.
  • textile -- Initial support as of aug 2, 2004. See Textile.

Source Code Support

The system includes processors to provide inline syntax highlighting] for these languages:

  • c -- C
  • cpp -- C++
  • python -- Python
  • perl -- Perl
  • ruby -- Ruby
  • php -- PHP
  • asp --- ASP
  • sql -- SQL
  • xml -- XML

By using the mime-type as processor, it is posible to syntax-highlight the same languages that are supported when browsing source code.

For example, you can write:

{{{
#!text/html
<h1>text</h1>
}}}

The result will be syntax highlighted html code. The same is valid for all other mime types supported.


See also : WikiMacros, WikiHtml, WikiRestructuredText, WikiFormatting, SystemGuide