diff --git a/src/render/markdown.ts b/src/render/markdown.ts index c0f25fd..f42680b 100644 --- a/src/render/markdown.ts +++ b/src/render/markdown.ts @@ -87,7 +87,6 @@ export async function renderMarkdown( return depth === 0 ? `${trimmed}\n\n` : `\n${trimmed}`; }, listItem: (children, { index, depth, ordered, start, checked }) => { - const indent = " ".repeat(depth); let marker = ""; if (checked !== undefined) { marker = checked ? "• [✓]" : "• [ ]"; @@ -98,9 +97,12 @@ export async function renderMarkdown( marker = "•"; } - return Bun.wrapAnsi(`${indent} ${marker} ${children}\n`, columns, { - trim: false, - }); + const cols = columns - (depth + 1) * 2; + return Bun.wrapAnsi(`${marker} ${children}`, cols, { trim: false }) + .split("\n") + .map((line) => ` ${line}`) + .join("\n") + .concat("\n"); }, hr: () => `${chalk.dim("─".repeat(columns))}\n\n`, table: (_children) => { @@ -126,7 +128,7 @@ export async function renderMarkdown( strong: (children) => chalk.bold(children), emphasis: (children) => chalk.italic(children), strikethrough: (children) => chalk.grey.strikethrough(children), - codespan: (children) => chalk.bgBlack.yellowBright(` ${children} `), + codespan: (children) => chalk.bgBlack.yellowBright(children), link: (children, { href }) => chalk.blueBright.underline(terminalLink(children, href)), image: () => "",