Hi
I’m trying to understand the example /site/plugins/markdown-parser/index.php:
Kirby::plugin('my/markdown', [
'components' => [
'markdown' => function (Kirby $kirby, string $text = null, array $options = [], bool $inline = false) {
return YourMarkdownParser::parse($text);
}
]
]);
I assume that I have to place the implementation of YourMarkdownParser inside the plugin folder. Right?
Could I instead do
'markdown' => function (Kirby $kirby, string $text = null, array $options = [], bool $inline = false) {
require_once __DIR__ . 'YourMarkdownParser.php';
$my = new YourMarkdownParser();
return $my->parse($text);
}
Actually, I tried that and it seems to work. Except that I get an error message in the page panel: Class “YourMarkdownParser” not found
So, what did I get wrong here?
I guess I’d have to somehow make Kirby be aware of my new Class, right?
If so, how do I do that?
Thanks,
Dieter