]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/ikiwiki/directive/format.mdwn
Add usage example
[git.ikiwiki.info.git] / doc / ikiwiki / directive / format.mdwn
1 The `format` directive is supplied by the [[!iki plugins/format desc=format]]
2 plugin.
4 The directive allows formatting a chunk of text using any available page
5 format. It takes two parameters. First is the type of format to use,
6 ie the extension that would be used for a standalone file of this type.
7 Second is the text to format.
9 For example, this will embed an otl outline inside a page using mdwn or
10 some other format:
12         \[[!format otl """
13         foo
14                 1
15                 2
16         bar
17                 3
18                 4
19         """]]
21 Note that if the [[!iki plugins/highlight desc=highlight]] plugin is enabled, this directive can also be
22 used to display syntax highlighted code. Many languages and formats are
23 supported. For example:
25         \[[!format perl """
26         print "hello, world\n";
27         """]]
29 `format` can also be used to format entire source files and display them on a page. Simply put an [[inline]] directive with the `raw` attribute set inside a `format`. This can be useful if you want to both serve the file raw, as well as show it syntax highlighted on a page. An example:
31         \[[!format python """
32         [[!inline pages="program.py" raw="yes"]]
33         """]]
35         \[[View raw file|program.py]]
37 [[!meta robots="noindex, follow"]]