diff --git a/config.rb b/config.rb index 31e4d2ca373..c69665926c8 100644 --- a/config.rb +++ b/config.rb @@ -1,3 +1,5 @@ +require './lib/redcarpet_header_fix' + set :css_dir, 'stylesheets' set :js_dir, 'javascripts' @@ -34,3 +36,4 @@ # Or use a different image path # set :http_prefix, "/Content/images/" end + diff --git a/lib/redcarpet_header_fix.rb b/lib/redcarpet_header_fix.rb new file mode 100644 index 00000000000..170d4b843d7 --- /dev/null +++ b/lib/redcarpet_header_fix.rb @@ -0,0 +1,9 @@ +module RedcarpetHeaderFix + def header(text, level, id) + clean_id = id.gsub(/[\.]/, '-').gsub(/[^a-zA-Z0-9\-_]/, '') + "#{text}" + end +end + +require 'middleman-core/renderers/redcarpet' +Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, RedcarpetHeaderFix