From 67c90c16f12bd74f055121a6853d9554dcbeccee 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