ruby-on-rails-4markdownbluecloth

Bluecloth: markdown to HTML results in lots of empty tags


For example, the following markdown:

# Game Version
Need For Speed Most Wanted v1.3 English version.

Results in the following HTML:

<h1>Game Version</h1>
<p></p>
<p></p>
<p>Need For Speed Most Wanted v1.3 English version.</p>
<p></p>
<p></p>

This is even more annoying in lists where every <li></li> is <br><li></li><br>, contrary to the markdown spec. I have checked my markdown and there are no extra end-of-line spaces or anything of the sort. The data is stored as a text field on Heroku Postgres.

Is this a problem with Bluecloth, or am I doing something terribly wrong?


Solution

  • I was actually calling simple_format on the returned string in the view:

    simple_format BlueCloth.new(@event.description)
    

    Replacing simple_format with raw fixed the problem.