I try to use snippets inside a kirbytag to reuse some components. it works but I get some strange p-tags at the beginning and at the end of my container o-grid-wrap.
here a some screenshots of my kirbytag, my snippet and the output.
First of all, could you please post your code as a code block (begin and end with three backticks). It is easier to read and correct.
And could you please post a part of your website´s source code, instead of the DOM-Tree, because sometimes the browser tries to fix tags and adds closing html tags itself.
And could you please post a part of your website´s source code, instead of the DOM-Tree, because sometimes the browser tries to fix tags and adds closing html tags itself.
I know, but in this case the DOM-Tree has the same structure like the source-view and the screenshot is more readable. But here we go with the source-view:
</div></div></div><div class="o-grid-wrap u-clearfix"><div class="l1-l14"></p>
<h4>Test Titel</h4>
<p></div></p>
<div class="l5-l12">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. </p>
<p>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p></div>
<p></div><div class="o-grid-wrap u-clearfix"><div class="l5-l12"><div class="c-standard-text c-font-style-f">
I don´t know, when exactly the kirbytags are executed. It seems to be, that the text is loaded from the file, all kirbytags are replaced/ parsed and then the markdown parser runs on that text.
This is my assumption, because every line break in your code is interpreted as the end of a paragraph, except the headings.
We should ask @lukasbestle or @texnixe about that.
I think the best approach would be to use a post filter instead of the Kirbytag. This post filter would then find tags with a different syntax (like {snippet: something}). This would avoid the interference with the Markdown parser.
Strangely enough even when @jensfranke solution - i get everything wrapped in <p> tags.
Its a year old post so maybe something has changed?
I just want to create some block elements using kirby text tags. Strangely enough kirbytext::$tags['image'] (in core in kirby/extensions/tags.php) doesnt seem to have any special treatment yet it is not wrapperd in <p> when used (it is wrapped in <figure> but thats something generated in the tag).