Closed neildaniels closed 5 years ago
I always had planned to add a second hook that wraps around Kirbytext entirely but I have to admit that I forgot about it. It's now implemented.
That means that you have the following hooks:
kirbytags:before kirbytags:after kirbytext:before kirbytext:after
The kirbytext:before hook is running before kirbytags are being parsed and kirbytext:after is running after the tags have been parsed and markdown has been applied.
With this you have full control where to interject the parsing.
It might make sense to add markdown:before and markdown:after later, but with this change we have no regression in comparison to v2 anymore.
Describe the bug According to the docs, the
kirbytags:after
hook should occur after Markdown is parsed. However, it seems to occur before parsing occurs, because the$text
variable in the callback still has unparsed Markdown.This has been tested on latest Starterkit with the following set plugin:
If using the Starterkit content, I simply replaced the
/photography
album description with:To Reproduce Steps to reproduce the behavior:
kirbytags:after
hookExpected behavior The example above is a bit confusing, because I echo out the text and return the text. The echo'd version is more obvious, because the returned value may still be parsed by Markdown (which is unexpected).
I would expect that the
$text
variable would have no*
characters and no#
style headings. It should have proper HTML entities.The
$text
variable should not have raw markdown at this point.Kirby Version
3.0.0-RC-4.0
(StarterKit)