ruby-on-railsruby-on-rails-3hamlrdiscount

rdiscount + haml in Rails 3 problem


Ok, I hope this is a simple typo or something, but I've got a problem trying to get HAML to print markdown text. The relevant portion of my gemfile looks like this:

gem 'rdiscount'

My text looks like this:

### TEST HEADING ###
Here's some text.

My view code looks like this:

%h1= @article.title
.body
  :markdown
    = @article.body

but what renders on the page is:

Article Title

= @article.body

So not only is it not formatting the markdown, it's not even outputting the content of @article.body.

Any help?


Solution

  • You should use this instead:

    %h1= @article.title
    .body
      :markdown
        #{@article.body}