Skip to content

Commit 55f6665

Browse files
committed
- Fix Table of Contents for headers with diacritics (requires pandoc renderer)
1 parent 064c928 commit 55f6665

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/madness/inline_table_of_contents.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def toc_item(line)
3636
level = matches[:level].size - 2
3737

3838
spacer = ' ' * level
39-
"#{spacer}- [#{text}](##{text.to_slug})"
39+
slug = text.to_slug
40+
slug = slug.remove(/^[\d\-]+/) if config.renderer == 'pandoc'
41+
"#{spacer}- [#{text}](##{slug})"
4042
end
4143

4244
def caption

spec/approvals/render/diacritics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h2 id="table-of-contents">Table of Contents</h2>
22

33
<ul>
4-
<li><a href="#2-4-prava-plastov-krabi-ky-pro-elektroniku">2.4. Úprava plastové krabičky pro elektroniku</a></li>
4+
<li><a href="#2-4-%C3%BAprava-plastov%C3%A9-krabi%C4%8Dky-pro-elektroniku">2.4. Úprava plastové krabičky pro elektroniku</a></li>
55
</ul>
66

77
<h2 id="2-4-prava-plastov-krabi-ky-pro-elektroniku">2.4. Úprava plastové krabičky pro elektroniku</h2>

0 commit comments

Comments
 (0)