Replaces Kirby’s markdown component for one that uses CommonMark. It uses league/commonmark, a Markdown parser for PHP which supports the full CommonMark spec.
As a git submodule: git submodule add [email protected]:iksi/kirby-commonmark.git site/plugins/kirby-commonmark
. Or you can put the contents of the repository in site/plugins/kirby-commonmark
.
Next the league/commonmark dependency needs to be installed with composer: composer require league/commonmark:^0.16
. Require the generated vendor/autoload.php
file from a custom site.php
:
<?php
require_once __DIR__ . DS . 'vendor' . DS . 'autoload.php';
$kirby = kirby();
c::set('plugin.commonmark', true);
c::set('plugin.commonmark.config', []);
Options for plugin.commonmark.config
are listed on https://commonmark.thephpleague.com/configuration/.
You can add your own extensions (bundled custom parsers/renderers), see customization:
c::set('plugin.commonmark.extensions', []);