Skip to content

Commit 88008e5

Browse files
ykztshiyuki2578
authored andcommitted
Respect original ID with ToC (mastodon#11895)
1 parent db81368 commit 88008e5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/lib/toc_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def parse_and_transform
4545
parsed_html.traverse do |node|
4646
next unless TARGET_ELEMENTS.include?(node.name)
4747

48-
anchor = node.text.parameterize
48+
anchor = node['id'] || node.text.parameterize
4949
@slugs[anchor] += 1
5050
anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1
5151

0 commit comments

Comments
 (0)