Use TikiWiki plugins, tables, and syntax in your Grav site.
This plugin allows using TikiWiki style syntax. See TikiWiki Syntax.
Code inside of markdown code-fences will not be processed.
TikiWiki allows for a very succinct style table using double pipes.
||
Steven | male
Jennifer | female
Melody | female
||
When rendered, it will look like this:
Steven | male Jennifer | female Melody | female |
---|
Tiki allows ((Page-Title)) style links. The backend looks up the page using the page title. You can use the either route or title in the parenthesis.
Go ((My Page))
Go ((/my-page))
will create a link
<a href='/my-page'>My Page</a>
If a page is not found, the link will navigate to a Create New Page destination.
If the page does not have a title, the route will be tested instead.
Tiki allows [http:www.twelvetone.tv] style links. The markdown trailing parenthesis (the URL part) is copied from the brace content (the text part). To qualify, the following conditions must be met:
TikiWiki uses a plugin style that allows for calling a registered plugin with key-value parameters.
Here is the syntax
{PLUGIN_NAME(aParam="a value" anotherParam="another value")}
Here is the plugin data...
{PLUGIN_NAME}
We currently support TABLE, FANCYTABLE, and CODE plugins, along with custom plugins registered by other Grav plugins.
{TABLE(head="Name|Gender")}
Steven | male
Jen | female
Melody | female
{TABLE}
Will render as:
{TABLE(head="Name|Gender")} Steven | male Jen | female Melody | female {TABLE}
{CODE(type="xml" caption="Here's the code")}
<parent>
<child age='12'>First</child>
<child age='10'>Second</child>
</parent>
{CODE}
{CODE(type="javascript")}
const foo = "bar";
function doIt() {
return 4*4;
}
{CODE}
Will render as:
{CODE(type="xml" caption="Here's the code")}
{CODE}
{CODE(type="javascript")} const foo = "bar"; function doIt() { return 4*4; } {CODE}
We use Grav's built-in Pimple container to create a plugin registry under the key tiki.
Here's a simple plugin definition.
// get the registry
$registry = $this->grav['tiki'];
// register the tiki plugin
$registry->register("RANDOM", function($map, $contents) {
$min = get($map, "min", 0);
$max = get($map, "max", 100);
$r = rand($min, $max);
return "The random number is $r, and your contents are <em>$contents.</em>";
});
The callback function has these properties:
$map | A map of the configuration parameters. $contents | The contents of the plugin code (between the {} markers). return | A string with the raw markdown code to inject into the document. |
---|
You would use the Tiki plugin in your Grav page like this:
{RANDOM(min="10" max="20")}
Hello World
{RANDOM}
And the output would be:
{RANDOM(min="10" max="20")} Hello World {RANDOM}