fix(markdown): correct list item whitespace and indentation
This commit is contained in:
parent
5b138df664
commit
e1033398e9
3 changed files with 6 additions and 4 deletions
|
|
@ -7,7 +7,7 @@
|
|||
"ttsc": "dist/tts.js"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "pnpm run bundle src/index.ts &>/dev/null && node dist/index.js",
|
||||
"dev": "pnpm run bundle src/index.ts >/dev/null && node dist/index.js",
|
||||
"check": "biome check --write && pnpm run tc",
|
||||
"clean": "rm -rf dist",
|
||||
"build": "pnpm run check && pnpm run bundle --minify src/index.ts && pnpm run bundle --minify src/tts.ts",
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default class Renderer {
|
|||
this.charsSinceNL = this.charsSinceNL - columns;
|
||||
}
|
||||
|
||||
if (this.lineCount >= Math.max(rows - 10, 1)) {
|
||||
if (this.lineCount >= Math.max(rows - 4, 1)) {
|
||||
this.moveClearReset(-this.lineCount, pipe);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,11 +76,12 @@ class LmcRenderer extends Renderer {
|
|||
this.listitem(item, ordered ? num + index : undefined),
|
||||
)
|
||||
.join("\n");
|
||||
|
||||
return `\n${renderedItems}\n`;
|
||||
}
|
||||
|
||||
override listitem({ tokens }: Tokens.ListItem, num?: number) {
|
||||
const text = this.parser.parse(tokens).trim();
|
||||
const text = this.parser.parse(tokens);
|
||||
let marker = "";
|
||||
if (num !== undefined) {
|
||||
marker = `${num}.`;
|
||||
|
|
@ -91,7 +92,8 @@ class LmcRenderer extends Renderer {
|
|||
const item = `${marker} ${text}`;
|
||||
return item
|
||||
.split("\n")
|
||||
.map((line) => (line.length > 0 ? ` ${line}` : ""))
|
||||
.filter((line) => line.length > 0)
|
||||
.map((line) => ` ${line}`)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue