refactor: state rendering
This commit is contained in:
parent
e91a8a20a1
commit
efb44c4414
3 changed files with 16 additions and 16 deletions
|
|
@ -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"),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue