Kirbytext ignores line breaks

Why is my textarea ignoring line breaks?
I tried to make a break with just “Enter”; with “Shift + Enter” and even with a “< br >”

Textarea in my panel:

Rendered Text on website:

I render it like this:

<h4>
    <?= $site->imprintText()->kt()->inline() ?>
</h4>

My site.yml blueprint:

  imprintTab:
    label: Imprint / Privacy Policy

    columns:
      imprintleft:
        width: 1/2
        fields:
          imprintText:
            label: Imprint Text
            type: textarea
            buttons: 
              - link
              - email

      imprintright:
        width: 1/2
        fields:
          privacyPolicyText:
            label: Privacy Policy Text
            type: textarea
            buttons: 
              - link
              - email

Inserting a single line
break works, but as soon as I want to insert a double line

break, it is not displaying even a single line break…

Remove inline

already tried to remove it and there is no difference. Also I need the text to be an h4, not a paragraph…

Hey Marcel, it makes a difference whether you use the ->inline() conversion or not, you probably just didn’t see one in the visual output. What you try to achieve doesn’t work well with the defaults of these Kirby fields.

You set a textarea field in Panel which means a rich text field with rendered blocks. This usually renders full block HTML, meaning its own paragraphs etc. Once you convert to inline it removes all the block elements into inline text.

Your expected output can be better created using a Writer field with the inline option being set. See the docs for more infos.

Ensure that your Markdown config options reflect your desired output as well.

2 Likes

Thanks @helloanselm, the writer field works perfectly for me, I was not aware of it yet.