middleman / middleman-syntax

Code syntax highlighting plugin via Rouge for Middleman
https://middlemanapp.com
MIT License
179 stars 57 forks source link

Problem with highlighting code containing Erb #29

Closed markoa closed 10 years ago

markoa commented 11 years ago

Hi, I've been writing blog posts in Middleman as .md files. Now I have a helper that I need to use in posts, so I'm converting to .md.erb.

When there is Erb code in a syntax highlighting block however, the engine wants to evaluate it and page rendering fails (eg with "undefined method `each' for nil:NilClass"):

<% code("erb") do %>
<!-- app/views/posts/index.html.erb -->
<ul>
  <% @posts.each do |post| %> <<<< error
    <li>
      <%= post.title %><br />
      <%= post.content %>
    </li>
  <% end %>
<ul>
<% end %>

This is my current Middleman config.rb: https://gist.github.com/markoa/6534662

If you have any idea what I'm doing wrong, please help.

bhollis commented 11 years ago

I just googled "escape erb": http://archive.railsforum.com/viewtopic.php?id=11130

markoa commented 10 years ago

Thanks man!