mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Add fallback section ID with ToC (#11941)
This commit is contained in:
parent
1051c5cffa
commit
67bef15e53
@ -45,7 +45,7 @@ class TOCGenerator
|
|||||||
parsed_html.traverse do |node|
|
parsed_html.traverse do |node|
|
||||||
next unless TARGET_ELEMENTS.include?(node.name)
|
next unless TARGET_ELEMENTS.include?(node.name)
|
||||||
|
|
||||||
anchor = node['id'] || node.text.parameterize
|
anchor = node['id'] || node.text.parameterize.presence || 'sec'
|
||||||
@slugs[anchor] += 1
|
@slugs[anchor] += 1
|
||||||
anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1
|
anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user