Markdown outputting to text of article

In the Panel when I use Markdown in the textarea it will output to the HTML. It is the same if I use the wysiwyg to link in an image.

I’m doing something wrong but I don’t know what?

Have you tried: $page()->text()->kirbytext() ?

Threw up an error but…


…did not.

It did not change the Markdown though. Gonna go read the docs about kirbytext as this is obviously where I am missing info. Thank you for your help!

That’s the correct code, the parenthesis after the variable don’t make sense.

Ok, so I got it.

So every /panel input type text requires ->kirbytext() to convert to markdown.

No, only fields that use markdown, like the textarea field. The kirbytext() method converts Markdown and Kirbytext to HTML, not the other way round.

Sorry I wrote it in the wrong order. But I understand now. Thank you

If this…

<?= $page->intro()->kirbytext() ?>

outputs this…

<p>Some text</p>

How do I prevent <p class="lead"><?= $var->intro()->kirbytext() ?></p> becoming…

<p class="lead"></p>
<p>Some text</p>

Kirbytext creates valid HTML with paragraphs. If you want to disable this you have to use Kirbytextinline.

<p class="lead"><?= $var->intro()->kirbytextinline() ?></p>`

Or with shortcode:

<p class="lead"><?= $var->intro()->kti() ?></p>


1 Like

@Oli1 thanks. thats exactly what I needed

Is it ok @mention folks when replying to their posts

Glad that I could help! Sure it’s ok to mention