Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > a2ac79ac252ef7b89f2f0fc449728720 > files > 235

ikiwiki-3.20190228-1.1.mga6.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>format</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../../style.css" type="text/css" />

<link rel="stylesheet" href="../../local.css" type="text/css" />






<meta name="robots" content="noindex, follow" />



</head>
<body>

<div class="page">

<div class="pageheader">
<div class="header">
<span>
<span class="parentlinks">

<a href="../../index.html">ikiwiki</a>/ 

<a href="../../ikiwiki.html">ikiwiki</a>/ 

<a href="../directive.html">directive</a>/ 

</span>
<span class="title">
format

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p>The <code>format</code> directive is supplied by the <a href="http://ikiwiki.info/plugins/format/">format</a>
plugin.</p>

<p>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.</p>

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

<pre><code>[[!format  otl """
foo
    1
    2
bar
    3
    4
"""]]
</code></pre>

<p>Note that if the <a href="http://ikiwiki.info/plugins/highlight/">highlight</a> plugin is enabled, this directive can also be
used to display syntax highlighted code. Many languages and formats are
supported. For example:</p>

<pre><code>[[!format  perl """
print "hello, world\n";
"""]]
</code></pre>

<p><code>format</code> can also be used to format entire source files and display them on a page. Simply put an <a href="./inline.html">inline</a> directive with the <code>raw</code> attribute set inside a <code>format</code>. 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:</p>

<pre><code>[[!format  python """
[[!inline pages="program.py" raw="yes"]]
"""]]

[[View raw file|program.py]]
</code></pre>

</div>







</div>

<div id="footer" class="pagefooter" role="contentinfo">

<div id="pageinfo">






<div id="backlinks">
Links:

<a href="../../plugins/format.html">plugins/format</a>


</div>






<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> -->
</div>

</div>


<!-- from ikiwiki -->
</div>

</div>

</body>
</html>