Skip to content

Commit 8af5c32

Browse files
committed
Avoid conflicts on id generated for the TOC
1 parent c97d895 commit 8af5c32

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/html/pipeline/toc_filter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def call
2222

2323
uniq = (headers[name] > 0) ? "-#{headers[name]}" : ''
2424
headers[name] += 1
25-
node['id'] = "#{name}#{uniq}"
25+
node['id'] = "toc-#{name}#{uniq}"
2626

2727
if was < level
2828
while was < level
@@ -37,7 +37,7 @@ def call
3737
end
3838
toc << "<li>"
3939
end
40-
toc << "<a href=\"##{name}#{uniq}\">#{node.inner_html}</a>"
40+
toc << "<a href=\"#toc-#{name}#{uniq}\">#{node.inner_html}</a>"
4141
end
4242

4343
length = 0

0 commit comments

Comments
 (0)