diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-12-08 14:20:31 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-12-08 14:20:31 +0000 |
commit | 1fb49ccd7bb37d5d6bde12397f32e1c04fc009ba (patch) | |
tree | c42df47ade7fad6529f59398d5e1275619994fd9 /lib/banzai | |
parent | 103269b9a6d92ff3d4d0f3b69e4653e3f0ef7744 (diff) | |
parent | 3e83d9f73a2dbec010026dbcd24effe89d4dc16f (diff) | |
download | gitlab-ce-1fb49ccd7bb37d5d6bde12397f32e1c04fc009ba.tar.gz |
Merge branch 'jprovazn-ignore-anchors' into 'master'
Use prefix for TableOfContents filter hrefs
Closes #38473
See merge request gitlab-org/gitlab-ce!15806
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/table_of_contents_filter.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/banzai/filter/table_of_contents_filter.rb b/lib/banzai/filter/table_of_contents_filter.rb index 47151626208..97244159985 100644 --- a/lib/banzai/filter/table_of_contents_filter.rb +++ b/lib/banzai/filter/table_of_contents_filter.rb @@ -32,6 +32,7 @@ module Banzai .gsub(PUNCTUATION_REGEXP, '') # remove punctuation .tr(' ', '-') # replace spaces with dash .squeeze('-') # replace multiple dashes with one + .gsub(/\A(\d+)\z/, 'anchor-\1') # digits-only hrefs conflict with issue refs uniq = headers[id] > 0 ? "-#{headers[id]}" : '' headers[id] += 1 |