pasting following code into the panel field parsed by kirbytext() only outputs code for figure.img[src=a.jpg] and b.jpg does not appear at all. any ideas how to fix this?
i need the markdown=1 flag since the code from the div is actually created by a custom tag. that tag should be able to contain other tags. something like @texnixe’s columns.
that plugin needs a newline after the (columns…), right? which might be error prone and/or cause confusion for my client. as far as i can see it uses regex… which i am not very good at (yet).
i tried to implement the same code like the original kirby textsnippets, no regex, just replacing. problem is still there. maybe markdown.extra and kirbytext() do not play well together.
i just found out how to make it work. adding spaces or newline.
with markdown extra active you need to have extra space or a newline after first kirbytag image, and it works. so maybe the markdown extra is confusing the regex of kirbytext()?
i can not see why using akirbytext::$pre[] function should be better than a tag. both are regex based (preg_replace_callback) and executed right after each other. tags just provide easier access to attributes.
still tags fail where the kirbytext::$pre works. so i want to find out why.
what are the ! and !is in the preg_replace_callback for anyway?
As I said, it was not my tag and as far as I remember I copied it for testing from @NECKRHINOS because of a similar issue which was never resolved. I should just delete it.
If you look closely at the columns plugin, you see that it doesn’t return start and end tags separately but matches the whole column block and parses the content using Kirbytext itself.
As you wrote and Sonja confirmed, tags are not meant to return incomplete HTML, they can only return HTML that is properly closed.
The point of the Kirbytext pre filter is to match more than just individual tags. If you just plug the regular expression that I proposed above into the columns plugin and modify the callback function according to your needs, it should be fine. Don’t try to return incomplete HTML from the filter either, it won’t work.
The exclamation marks are the open and close characters (you could use slashes instead if you want). is means “case insensitive” and “singleline” (= the regex works with newlines in the matched text).