Hey there,
when I was looking for a way to add classes to <code>
elements generated by kirbytext()
, I stumbled upon Taufik Nurrohman’s great ParsedownExtra (which is included by default) extension ParsedownExtraPlugin.
Sourcery!
It easily adds some noteworthy features (see here for the complete list of possible options) - here goes:
Getting started
Use one of the following methods to install & use kirby-pep
:
Git submodule
If you know your way around Git, you can download this plugin as a submodule:
git submodule add https://github.com/S1SYPHOS/kirby-pep.git site/plugins/kirby-pep
Clone or download
Activate the plugin
Activate the plugin with the following line in your config.php
:
c::set('plugin.kirby-pep', true);
In order to enable features of ParsedownExtraPlugin, read on about configuring it. If you want to activate kirby-pep
only on specific domains, read about multi-environment setups.
Configuration
Change kirby-pep
options to suit your needs:
Option | Type | Default | Description |
---|---|---|---|
plugin.kirby-pep.code_class |
String | language-%s |
Defines the classes used by <code> elements (%s outputs the language specified at the beginning of your code block). |
plugin.kirby-pep.code_block_attr_on_parent |
Boolean | false |
Moves (inner) <code> element attributes on (outer) <pre> element. |
Currently only these two options are available. In the future, more options will be supported - feel free to open a PR! Apart from that, let me know what you think, every kind of feedback is appreciated.
Gosh, I just love the Kirby community.