fix: indent wrapped list items and remove codespan padding
This commit is contained in:
parent
22fc4c874f
commit
c051f340a8
1 changed files with 7 additions and 5 deletions
|
|
@ -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: () => "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue