From decfd2bde032abf0dee858599f35f48974d02a84 Mon Sep 17 00:00:00 2001 From: mitchell Date: Mon, 4 May 2026 18:28:14 -0400 Subject: [PATCH] fix: improve markdown list rendering and show messages for unsupported --- src/render/markdown.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/render/markdown.ts b/src/render/markdown.ts index f42680b..701f9ea 100644 --- a/src/render/markdown.ts +++ b/src/render/markdown.ts @@ -83,8 +83,8 @@ export async function renderMarkdown( return `\`\`\`${chalk.blue(meta?.language ?? "")}\n${toRender}\`\`\`\n`; }, list: (children, { depth }) => { - const trimmed = children.trimEnd(); - return depth === 0 ? `${trimmed}\n\n` : `\n${trimmed}`; + const trimmed = children.replaceAll("\n\n", "\n"); + return depth === 0 ? `${trimmed}\n` : `\n${trimmed}`; }, listItem: (children, { index, depth, ordered, start, checked }) => { let marker = ""; @@ -100,7 +100,7 @@ export async function renderMarkdown( const cols = columns - (depth + 1) * 2; return Bun.wrapAnsi(`${marker} ${children}`, cols, { trim: false }) .split("\n") - .map((line) => ` ${line}`) + .map((line) => (line.length > 0 ? ` ${line}` : "")) .join("\n") .concat("\n"); }, @@ -131,9 +131,9 @@ export async function renderMarkdown( codespan: (children) => chalk.bgBlack.yellowBright(children), link: (children, { href }) => chalk.blueBright.underline(terminalLink(children, href)), - image: () => "", + image: () => chalk.red("Images are unsupported (for now)\n"), text: (children) => children, - html: () => "", + html: () => chalk.red("HTML is unsupported\n"), }); return rendered.replace(/\n\n$/, "\n");