From 73a5ef03b2ea175a24c33257638f46f71d22b95a Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sat, 21 Sep 2019 00:13:45 +0900 Subject: [PATCH] Respect original ID with ToC (#11895) --- app/lib/toc_generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/toc_generator.rb b/app/lib/toc_generator.rb index c6e1795579..351675a5cd 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