I’m making a simple plugin to wrap some text in a field in my content page, inside a div with a certain class. So, in the page field it looks like this:
So far it’s working, but the problem is the ouput is rendering the markdown as it is, and not replacing # for the heading tags for example. I’ve been playing with adding text()->kt() as it works on the templates, but I haven’t managed to do the same in the plugin…
Since kt() is a field method (and as such requires a field object), you cannot call this method on a string. However, Kirby has the kirbytext() helper you can use here:
kirbytext($tag->text)
I’m not sure that using multiline text within a Kirbytag is such a great idea though. I think you’d be better of with a kirbytag hook.
Thanks, @bvdputte, I knew it was there but couldn’t find the plugin. If I see this correctly, though, it will replace all p’s from the text and use another wrapper instead?
Thanks! This works; I’ll use it as a workaround until I can research and learn how hooks work. The info box is a good example that I can adapt to my needs.