about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2019-09-21 00:13:45 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-09-20 17:13:44 +0200
commit73a5ef03b2ea175a24c33257638f46f71d22b95a (patch)
tree2d69a722f401fe125dba64eea4cc12dbdee1600c
parentb9a8b38844278f26b9d1d1d53256e0781ba3575a (diff)
Respect original ID with ToC (#11895)
-rw-r--r--app/lib/toc_generator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/lib/toc_generator.rb b/app/lib/toc_generator.rb
index c6e179557..351675a5c 100644
--- a/app/lib/toc_generator.rb
+++ b/app/lib/toc_generator.rb
@@ -45,7 +45,7 @@ class TOCGenerator
     parsed_html.traverse do |node|
       next unless TARGET_ELEMENTS.include?(node.name)
 
-      anchor = node.text.parameterize
+      anchor = node['id'] || node.text.parameterize
       @slugs[anchor] += 1
       anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1