Skip to content

Commit 14ce73e

Browse files
committed
feat: include h4 headings in [[toc]] generation
1 parent 968aa53 commit 14ce73e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

shared/jekyll-markdown-parser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ export class JekyllMarkdownParser {
188188
this.marked.parse(contentAfterMarker);
189189
const headings = getHeadingList();
190190

191-
// Filter to h2 and h3 only
192-
const relevantHeadings = headings.filter(h => h.level >= 2 && h.level <= 3);
191+
// Filter to h2, h3, and h4
192+
const relevantHeadings = headings.filter(h => h.level >= 2 && h.level <= 4);
193193

194194
if (relevantHeadings.length === 0) {
195195
return '';
@@ -207,7 +207,7 @@ export class JekyllMarkdownParser {
207207
// Generate markdown list
208208
return relevantHeadings
209209
.map(h => {
210-
const indent = h.level === 3 ? ' ' : '';
210+
const indent = ' '.repeat(h.level - 2); // h2='', h3=' ', h4=' '
211211
return `${indent}* [${h.text}](#${h.id})`;
212212
})
213213
.join('\n');

0 commit comments

Comments
 (0)