Skip to content

Commit 32db838

Browse files
committed
Don't put manual headings in TOC
1 parent d122f5d commit 32db838

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Changelog
22

33
## Next
4-
- Fix TOC being misplaced when non-wikitext headings are on the page.
4+
- Changed TOC generation to only include wikitext headings.
5+
- Fixed TOC being misplaced when non-wikitext headings are on the page.
56
- Fixed spacing issues in output.
67

78
## 1.3.5

src/compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function compile(dir: string = '.', config: Config = {}): void {
5151
// Create TOC
5252
if (!metadata.notoc && (metadata.toc || (outText.match(/<h\d[^>]*>/g)?.length || 0) > 3)) {
5353
let toc = '';
54-
let headings = Array.from(parsedContent.match(/<h\d[^>]*>.+?<\/h\d>/gs) || []);
54+
let headings = Array.from(parsedContent.match(/<h\d auto[^>]*>.+?<\/h\d>/gs) || []);
5555
headings.forEach(match => {
5656
const headingInner: string = match.replace(/\s*<\/?h\d[^>]*>\s*/g, '');
5757
const text = headingInner.replace(/<.+?>/g, ''); // remove tags from inner

0 commit comments

Comments
 (0)