1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Respect original ID with ToC (#11895)

This commit is contained in:
Yamagishi Kazutoshi 2019-09-21 00:13:45 +09:00 committed by Eugen Rochko
parent b9a8b38844
commit 73a5ef03b2

View file

@ -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