Using kirbytext() echo only specified number of paragraphs

I’ve run into a problem. I have a floated quote (or a pull quote, as it’s also being called) at the end of a text block (many paragraphs). For the text to wrap around it properly, the quote has to be located in the DOM at least few paragraphs before the text ends.
Using separate field for the whole text and for the quote, I would like to accomplish it (of course).

As for now, it looks like this:

<?= $text() ?>
<p>Some paragraps.</p>
<p>Some paragraps.</p>
<p>Some paragraps.</p>

<?= $quote() ?>
<blockquote>My blockquote</blockquote>

And the intended way of showing this:

<?= text(first part) ?>
<p>Some paragraps.</p>

<?= quote() ?>
<blockquote>My blockquote</blockquote>

<?= text(second part) ?>
<p>Some paragraps.</p>
<p>Some paragraps.</p>

So, is there anyway to insert the blockquote in the middle of the text from the other field? I don’t want to split the text into two parts (two fields) in the panel and just echo first part, then the quote, and then the second part. It’s awkward and the website is meant to be somewhat edited by a client. So having to manually split the content into two and also chosing how to split it is not an option in this case.

Maybe if I could somehow count the number of paragraphs to be echo’ed, then echo only part of them, insert blockquote and echo the rest of the text. But it’s just an idea and I’ve not found anything that would allow this.

I would of course be very grateful for any help. Greetings.

I think the best way would be to insert a kirbytag, e.g.


at the point in the text where the blockquote should appear.

The blockquote tag will then automatically pull in the blockquote. But that is again similar to a manual split.

Another option that could probably work is a kirbytext post filter, or a custom page method.

Actually Markdown supports the blockquote by default:

> My amazing blockquote

@lukasbestle: yes, but that way, you can’t style the blockquote, or you would have to wrap it within a div.

You could by targeting the quotes by element. Of course that only works if there is only one style of quote per text block. Just wanted to leave this here for reference.

Sorry, I guess my wording was not really precise. What I meant to say was that you can’t apply a class to markdown blockquotes to style them differently. With a kirbytag, however, you can.

(blockquote: class: pull-left)

One text field should be enough for that. If you need to have different directions / positions for the blockquotes you could also do something like this.

Yes, it was also my initial idea. I was just wondering whether there is a way to use Kirby engine to do it in a more elegant way (elegant for the client, since doing it this CSS way is elegant too, of course). This is somewhat not playing well with BEM approach, but that’s a minor problem.

Thank you all for your replies. Greetings to you.