Skip to content

Commit a181639

Browse files
committed
fix: prevent multiplicative indentation in nested lists (#57)
Adds negative lookahead to prevent adding indentation before nested list items. This fixes the multiplicative compounding bug where level 3 lists would get 6 spaces (2*3) instead of 4 spaces (2*2) with 2-space indent.
1 parent cc0b233 commit a181639

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const defaultTranslators: TranslatorConfigObject = {
138138
? PostProcessResult.RemoveNode
139139
: content
140140
.trim()
141-
.replace(/([^\r\n])(?:\r?\n)+/g, `$1 \n${indent.repeat(indentationLevel)}`)
141+
.replace(/([^\r\n])(?:\r?\n)+(?!\s*[-*+]|\s*\d+\.)/g, `$1 \n${indent.repeat(indentationLevel)}`)
142142
.replace(/(\S+?)[^\S\r\n]+$/gm, '$1 ')
143143
}
144144
},

0 commit comments

Comments
 (0)