middleman: Redcarpet & HAML not working correctly
Config
set :markdown_engine, :redcarpet
set :markdown, {smartypants: true, underline: true}
Haml
:markdown
-- "foo" _bar_ *test*
In the generated HTML the markdown is processed but the custom options (underline & smartypants in this example) aren’t applied.
Markdown files work fine, it just doesn’t work within the :markdown HAML filter.
module Haml::Filters
module Markdown
include Base
def render text
md_options = {smartypants: true, underline: true}
x = Redcarpet::Render::SmartyHTML.new md_options
y = Redcarpet::Markdown.new x, md_options
y.render text
end
end
end
This change I’m currently using adds the options, but isn’t using middleman’s custom RedcarpetTemplate which has many useful changes:
https://github.com/middleman/middleman/blob/v3-stable/middleman-core/lib/middleman-core/renderers/redcarpet.rb
and supports stuff like middleman-syntax within the markdown.
I think what’s happening by default is something like this:
module Haml::Filters
module Markdown
include Base
def render text
::Tilt['markdown'].new{ text }.render
end
end
end
But for some reason this isn’t applying the custom options.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 24 (10 by maintainers)
Commits related to this issue
- Don't ignore Markdown options in Haml filter This issue was detailed in #1152. Essentially we're not passing the :markdown options defined in config.rb to the Markdown renderer when we first go thro... — committed to olivierlacan/middleman by olivierlacan 7 years ago
- Don't ignore Markdown options in Haml filter This issue was detailed in #1152. Essentially we're not passing the :markdown options defined in config.rb to the Markdown renderer when we first go thro... — committed to olivierlacan/middleman by olivierlacan 7 years ago
Commenting in order to keep this open till we confirm whether it’s been fixed.
May be related to #1925. I will submit a PR to fix soon.