aboutsummaryrefslogtreecommitdiff
path: root/doc/ikiwiki/directive/format.mdwn
blob: ae976faed51456b218f5c332a84733469397c33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
The `format` directive is supplied by the [[!iki plugins/format desc=format]]
plugin.

The directive allows formatting a chunk of text using any available page
format. It takes two parameters. First is the type of format to use,
ie the extension that would be used for a standalone file of this type.
Second is the text to format.

For example, this will embed an otl outline inside a page using mdwn or
some other format:

	\[[!format otl """
	foo
		1
		2
	bar
		3
		4
	"""]]

Note that if the [[!iki plugins/highlight desc=highlight]] plugin is enabled, this directive can also be
used to display syntax highlighted code. Many languages and formats are
supported. For example:

	\[[!format perl """
	print "hello, world\n";
	"""]]

`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:

	\[[!format python """
	[[!inline pages="program.py" raw="yes"]]
	"""]]

	\[[View raw file|program.py]]

[[!meta robots="noindex, follow"]]