import type { BlockHandler } from "./handler.type.js"; import { identifyBlocks, resolveBlockHandler } from "./identify.js"; export const blockquoteHandler = { render(raw: string): string { const chunks = identifyBlocks(raw); const inner = chunks .map((c) => { const handler = resolveBlockHandler(c.type); return handler ? handler.render(c.raw, c.attrs) : ""; }) .join(""); return `
${inner}`; }, serialize(raw: string): string { return raw .split("\n") .map((line) => `> ${line}`) .join("\n"); }, } satisfies BlockHandler;