Skip to content

Commit 22191c2

Browse files
committed
fix: correct TOC indentation to use 2 spaces per level instead of 4
## CHANGES - Fix indentation calculation for TOC subsections - Change from 4-space to 2-space indentation - Update indent formula to `level - 1` - Bump version from 1.3.2 to 1.4.0
1 parent 87716db commit 22191c2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin/md-tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ For more information, visit: https://github.com/ksylvan/markdown-tree-parser
715715
}
716716
} else if (heading.level > 2 && currentLevel2Filename) {
717717
// This is a subsection within a level 2 section
718-
const indent = ' '.repeat(heading.level - 2);
718+
const indent = ' '.repeat(heading.level - 1);
719719
const anchor = this.createAnchor(heading.text);
720720
toc += `${indent}- [${heading.text}](./${currentLevel2Filename}#${anchor})\n`;
721721
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kayvan/markdown-tree-parser",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"description": "A powerful JavaScript library and CLI tool for parsing and manipulating markdown files as tree structures using the remark/unified ecosystem",
55
"type": "module",
66
"main": "index.js",

0 commit comments

Comments
 (0)