Is there a way to parse a line of Markdown within Twig – without the surrounding
<p>
tags?
I see there is a StringHelper method called ParseMarkdownLine that does exactly what I'd like, but I haven't found a way to invoke it in my templates.
Is there a way to parse a line of Markdown within Twig – without the surrounding
<p>
tags?
I see there is a StringHelper method called ParseMarkdownLine that does exactly what I'd like, but I haven't found a way to invoke it in my templates.
If you're here looking for a Craft 3 answer, the Wordsmith plugin offers the same ability to only parse inline and not include paragraph tags:
{{ entry.title|markdown(inlineOnly=true) }}
Have a look at the Parsedown plugin by P&T, it provides a line mode to not output any wrapping <p>
tags.
{{ entry.title|parsedown('line') }}
{{ item | markdown | replace('<p>','') | replace('</p>','') | raw }}
works for a single line, but it does not feel right.