diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2018-06-15 11:55:51 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2018-06-15 11:55:51 +0300 |
commit | 4d202f54c5f91228520683360e533d64eceaf277 (patch) | |
tree | 0e6d525e8bd93a4e5987aef3380ac19911ba4b39 | |
parent | 6c6fe19ec898367e0147cff511714c69ecac63ec (diff) |
Fix strange anchor links caused by single quotes
-rw-r--r-- | lib/helpers/redcarpet_render.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/helpers/redcarpet_render.rb b/lib/helpers/redcarpet_render.rb index fe59d31e..86e2a07e 100644 --- a/lib/helpers/redcarpet_render.rb +++ b/lib/helpers/redcarpet_render.rb @@ -12,6 +12,7 @@ module Nanoc::Helpers anchor = text.gsub(/\s+/, '-').gsub(/<\/?[^>]*>/, '').downcase # https://github.com/rails/rails/blob/e491b2c06329afb3c989261a2865d2a93c8b84b8/activesupport/lib/active_support/inflector/transliterate.rb#L86 anchor.gsub!(/[^a-z0-9\-_]+/i, '-') + anchor.gsub!(/39-/, '') # remove weird symbol https://gitlab.com/gitlab-com/gitlab-docs/issues/84 anchor.squeeze!('-') # replace multiple dashes with one anchor.gsub!(/^-|-$/, '') # remove any first or last dashes |