Respect original ID with ToC (#11895)

lolsob-rspec
Yamagishi Kazutoshi 2019-09-21 00:13:45 +09:00 committed by Eugen Rochko
parent 53ceb703b3
commit 67c90c16f1
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class TOCGenerator
parsed_html.traverse do |node| parsed_html.traverse do |node|
next unless TARGET_ELEMENTS.include?(node.name) next unless TARGET_ELEMENTS.include?(node.name)
anchor = node.text.parameterize anchor = node['id'] || node.text.parameterize
@slugs[anchor] += 1 @slugs[anchor] += 1
anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1 anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1