If I start rails console
and enter:
Redcarpet::Markdown.new(Redcarpet::Render::HTML.new).render("line 1 \nline 2").html_safe
(Remember in markdown 2 spaces before a line break means a forced line break)
I get the expected: <p>line 1<br>\nline 2</p>\n
But if I use this code in ERB, all I see in my page source is the original text wrapped in a <p>
. The line break escape characters are preserved, but the 2 spaces are gone and there is no <br>
.
What gives? Thanks for your wisdom. Extra kudos if you explain how I could isolate the problem myself!