import { renderInline } from "../inline/render.js"; import type { BlockHandler } from "./handler.type.js"; import { indentWidth } from "./identify.js"; export function stripParagraphIndent(raw: string): string { const [first, ...rest] = raw.split("\n"); if (first === undefined || indentWidth(first) > 3) return raw; return [first.replace(/^[ \t]+/, ""), ...rest].join("\n"); } export const paragraphHandler = { render(raw: string): string { return `

${renderInline(stripParagraphIndent(raw))}

`; }, serialize(raw: string): string { return raw; }, } satisfies BlockHandler;