It seems HAML 4 is now using Tilt as its Filter for Markdown.
I didn't mention it but I was using lazy_require prior to try to migrate my code to Ruby 2 & HAML 4 but in HAML 4 lazy_require doesn't exist anymore.
Instead you have to use remove_filter method to disable default Markdown module prior redefining your own Markdown module.
Here is a basic working code :
module Haml::Filters
include Haml::Filters::Base
remove_filter("Markdown") # Removes basic filter (lazy_require is dead)
module Markdown
def render text
markdown.render text
end
private
def markdown
@markdown ||= Redcarpet::Markdown.new Redcarpet::Render::HTML, {
autolink: true,
fenced_code: true,
generate_toc: true,
gh_blockcode: true,
hard_wrap: true,
no_intraemphasis: true,
strikethrough: true,
tables: true,
xhtml: true
}
end
end
end
I encountered another problem after solving this because I was using RedCarpet instead of Redcarpet (NameError) and had a hard time realizing it :/…