I'm using Middleman (and Ruby, and Rails) for the first time, and I've hit a bit of a roadblock when it comes to rendering individual pages using Redcarpet as my markdown processor, and ERb for layout.
I want to use Markdown to style individual blocks of content, but each page will have more than one piece of content, uniquely styled.
Rather than using partials, is there a way to instantiate the Redcarpet renderer on multiple areas of the page? So in index.html.erb
, there would be something like this:
<div class="grid5 container">
<% markdown do %>
# Some markdown
<% end %>
</div>
<section class="grid6">
<% markdown do %>
## More markdown
<% end %>
</section>
I've tried to build a helper based on several tutorials, but I'm just not that good at Rails yet.
Edit My config.rb helper looks like:
module MD
def markdown(text)
Redcarpet.new(text).to_html
end
end
helpers MD
per ASCIIcasts, linked above, and my ERb template uses similar code to the above:
<span class="g6 pre3">
<% markdown do %>
...etc...
<% end %>
but I'm getting an error when I load the page: ArgumentError at /about
wrong number of arguments (0 for 1)