In particular, I'm trying to render the text in markdown preserving the original line breaks, like in the GitHub Flavored Markdown specifications.

Using {{ something | md }} in a template the output contains a line break only if a line ends with two spaces, like in the original markdown implementation.

Some markdown processors (ie Blackfriday, written in Go) call this feature "hardLineBreak".


I was able to get good results using {{ block.myFieldName|nl2br|markdown }}


There is a Craft Parsedown plugin for Craft which supports Github Flavored Markdown you can use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.