From: Yamagishi Kazutoshi Date: Fri, 20 Sep 2019 15:13:45 +0000 (+0900) Subject: Respect original ID with ToC (#11895) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=73a5ef03b2ea175a24c33257638f46f71d22b95a;p=mastodon.git Respect original ID with ToC (#11895) --- 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