Skip to content

Commit ee7402c

Browse files
committed
Fix TOC numbers
1 parent 5fee1e8 commit ee7402c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Fixed underscores appearing in the default page title when present in the URL.
99
- Fixed links not being automatically capitalised.
1010
- Fixed named references not working.
11+
- Fixed all index numbers in the TOC being '1'.
1112

1213
## 1.3.4
1314
*2024-05-18*

src/compile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export function compile(dir: string = '.', config: Config = {}): void {
5757
const lvl: number = +(match.match(/\d/g)?.[0] || -1);
5858
toc += `${`<ol>`.repeat(lvl - 1)} <li> <a href="#${encodeURI(text.replace(/ /g, '_'))}">${text}</a> </li> ${`</ol>`.repeat(lvl - 1)}`;
5959
});
60+
toc = toc.replace(/<\/ol>\s*<ol>/g, '');
6061
const tocElem = dedent`
6162
<div id="page+toc">
6263
<span id="page+toc+heading">

0 commit comments

Comments
 (0)