middleman / middleman-syntax

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

Does not work with Ruby 2.0.0-p0 #15

Closed oblitum closed 11 years ago

oblitum commented 11 years ago

Anytime I try use it like in haml (worked ok before) I get a blank web page without error log.

bhollis commented 11 years ago

Hmm, it works fine for me with Haml 4 and Ruby 2.0. Could you provide example code that doesn't work?

oblitum commented 11 years ago

The example code in the stack overflow answer which I've linked above doesn't work. The truth is that I get a blank page anytime I try to use -code("ruby") do. I've put the code snippet inside the index.html.haml from vocino's middleman-foundation project template and changed config.rb and the Gemfile accordingly to use middleman-syntax.

Gemfile:

source 'https://rubygems.org'

gem "middleman"
gem "zurb-foundation"

gem "redcarpet"
gem "middleman-syntax"

config.rb:

...
set :images_dir, 'images'

activate :syntax
set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true,
               :autolink => true, 
               :smartypants => true

# Build-specific configuration
...

index.html.haml:

...
    %h3 Tabs
    %dl.tabs
      %dd
        %a{:href => "#simple1"} Simple Tab 1
      %dd
        %a{:href => "#simple2"} Simple Tab 2
      %dd
        %a{:href => "#simple3"} Simple Tab 3
      %dd.active
        %a{:href => "#simple4"} Simple Tab 4
    %ul.tabs-content
      %li#simple1Tab This is simple tab 1's content. Pretty neat, huh?
      %li#simple2Tab This is simple tab 2's content. Now you see it!
      %li#simple3Tab This is simple tab 3's content. It's, you know...okay.
      %li#simple4Tab.active
        =preserve do
          -code("ruby") do
            :plain
              def my_cool_method(message)
                puts "Hello" + message
              end
    %h3 Buttons
...
bhollis commented 11 years ago

OK, I see. Well, it looks like Haml 4 doesn't work well with Padrino's content helpers, and everything's blowing up. This isn't specific to middleman-syntax as much as it has to do with how helpers have to work in general. I'm not really sure how to fix it without a lot of digging.

bhollis commented 11 years ago

Could you try with version 1.2.0?

happyrobots commented 11 years ago

I used version 1.1.1 and had the same problem as this issue. When I run with middleman server --verbose, the error is stack level too deep. After that, I tried version 1.2.0 and seems and run the middleman server with verbose mode again. The problem is markdown_engine is not defined.

/Users/nia/.rvm/gems/ruby-2.0.0-p0/gems/middleman-syntax-1.2.0/lib/middleman-syntax/extension.rb:17:in `registered': undefined method `markdown_engine' for Middleman::Application::MiddlemanApplication2:Class (NoMethodError)

I use HTML erb and code block. If I use markdown, this problem does not exist. It seems that this issue only happens when I use code block.

bhollis commented 11 years ago

@nmutiara what version of middleman are you using?

happyrobots commented 11 years ago

@bhollis I use middleman version 3.0.13. I tried version 3.0.14 and the problem persists.

bhollis commented 11 years ago

@nmutiara your problem (issue #21) has been fixed in version 1.2.1.

karlfreeman commented 11 years ago

If the problem persists, feel free to re-open :)