/** * Renders :::compare … ::: directive blocks. * * Using ::: (colon-fence) instead of backtick fences avoids conflicts when the compare * block's content itself contains fenced code blocks (```lang … ```). * * A compare block contains raw Markdown. For each block we: * 1. Render its inner Markdown with marked (same options as the parent document) * 2. Produce a
(highlighted client-side by hljs)
* - ld-compare-render : the rendered HTML, ready for wireContent.ts to apply table/blockquote styles
* 3. Embed the raw source in data-compare-source (URI-encoded) so wireContent.ts can apply
* table colors, callout icons etc. independently for each compare block.
*
* IMPORTANT — why we cannot inject the rendered HTML before the outer marked.parse():
* The rendered may contain blank lines (e.g. a code sample with a blank line
* between two functions). CommonMark terminates an HTML block at the first blank line, so
* marked would stop treating our as raw HTML at that blank line and re-parse the rest
* of the document as Markdown — corrupting everything after the blank line.
*
* To avoid this we use a two-phase approach: each :::compare block is replaced by a single
* HTML-comment placeholder (which marked passes through untouched, and which contains no
* blank lines), the document is parsed, then the placeholders are swapped for the rendered
* compare s afterwards.
*/
import { marked } from "marked";
/**
* Parse a Markdown document that may contain :::compare blocks and return the final HTML.
*
* This replaces the old `marked.parse(preprocessCompareBlocks(source))` pattern: compare
* blocks are rendered separately and stitched back in AFTER the outer parse, so their
* (possibly blank-line-containing) rendered HTML never disturbs the outer Markdown parsing.
*/
export declare function renderMarkdownWithCompareBlocks(source: string, markedOpts?: Parameters[1]): string;
//# sourceMappingURL=compareBlock.d.ts.map