diff --git a/guides/rails_guides/markdown.rb b/guides/rails_guides/markdown.rb index b422a807590..17035069d09 100644 --- a/guides/rails_guides/markdown.rb +++ b/guides/rails_guides/markdown.rb @@ -47,7 +47,12 @@ module RailsGuides end def dom_id_text(text) - text.downcase.gsub(/\?/, '-questionmark').gsub(/!/, '-bang').gsub(/[^a-z0-9]+/, ' ').strip.gsub(/\s+/, '-') + escaped_chars = Regexp.escape('\\/`*_{}[]()#+-.!:,;|&<>^~=\'"') + + text.downcase.gsub(/\?/, '-questionmark') + .gsub(/!/, '-bang') + .gsub(/[#{escaped_chars}]+/, ' ').strip + .gsub(/\s+/, '-') end def engine