diff --git a/package.json b/package.json index 690ac1a..b27a415 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/render/index.ts b/src/render/index.ts index 01fce63..a75eee2 100644 --- a/src/render/index.ts +++ b/src/render/index.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); } } diff --git a/src/render/markdown.ts b/src/render/markdown.ts index 4450ce0..ca7c59d 100644 --- a/src/render/markdown.ts +++ b/src/render/markdown.ts @@ -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"); }