Line breaks and text formatting issues

Hi there,

I have a reccurent kind of difficulties concerning linebreaks.

For the exact same field content that you can see above, here are the different renders :

<?= $page->intro()->kt() ?>
Kirby text : list-style ok but line breaks ignored.

<?= $page->intro()->kti() ?>
Kirby text inline ->kti() : line breaks ok but list-style ignored

<?= $page->intro()->markdown() ?>
Markdown ->markdown() : line breaks ok but list-style ignored

<?= $page->intro()->kti()->markdown() ?>
Kirbytext inline then markdown: list-style ok but too much
added for each line break,

  • correctly closed and empty paragraphs

    <?= $page->intro()->markdown()->kti() ?>
    Markdown then Kirbytext : perhaps the cleanest solution but there is still an unwanted
    between the

  • tags and extra empty


    Capture d’écran 2020-07-13 à 14.42.04

    Any idea ?

    Thanks for your help

  • What is your expected output? Why do you want additional br tags? The correct way to render your content is with simply using kirbytext() not in combination with anything else.

    1 Like

    Thanks for your answer.

    For my client, I want the front-end to behave as close as possible to the render of the text in the panel :
    carriage return in the panel -> carriage return in the front-end
    line break in the panel -> line break in the front-end

    Line feeds work by adding three spaces after a line (or enabling markdown breaks), but not between block elements. It’s not a good idea to enforce margins by adding line breaks, anyway.

    Bildschirmfoto 2020-07-13 um 15.05.22

    Ok I fixed it without using nothing else than kirbytext.

    Thanks @texnixe