refactor: state rendering

This commit is contained in:
mitchell 2026-05-08 08:54:57 -04:00
parent e91a8a20a1
commit efb44c4414
3 changed files with 16 additions and 16 deletions

View file

@ -83,7 +83,7 @@ export async function renderMarkdown(
return `\`\`\`${chalk.blue(meta?.language ?? "")}\n${toRender}\`\`\`\n`;
},
list: (children, { depth }) => {
const trimmed = children.replaceAll("\n\n", "\n");
const trimmed = children.replace(/\n+/g, "\n");
return depth === 0 ? `${trimmed}\n` : `\n${trimmed}`;
},
listItem: (children, { index, depth, ordered, start, checked }) => {
@ -132,7 +132,11 @@ export async function renderMarkdown(
link: (children, { href }) =>
chalk.blueBright.underline(terminalLink(children, href)),
image: () => chalk.red("Images are unsupported (for now)\n"),
text: (children) => children,
text: (children) =>
children
.replaceAll("$\\rightarrow$", "->")
.replaceAll("$\\leftarrow$", "<-")
.replaceAll("$\\to$", "->"),
html: () => chalk.red("HTML is unsupported\n"),
});