vantage-md 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.cjs CHANGED
@@ -2305,10 +2305,6 @@ const MarkdownViewer = (0, react.memo)(MarkdownViewerInner, (prevProps, nextProp
2305
2305
  //#endregion
2306
2306
  //#region src/renderMarkdown.ts
2307
2307
  /**
2308
- * Framework-agnostic markdown -> HTML rendering pipeline.
2309
- * Uses the same remark/rehype chain as the Vantage viewer.
2310
- */
2311
- /**
2312
2308
  * Render a markdown string to HTML using the full Vantage pipeline.
2313
2309
  *
2314
2310
  * Features (all enabled by default):
@@ -2325,7 +2321,7 @@ const MarkdownViewer = (0, react.memo)(MarkdownViewerInner, (prevProps, nextProp
2325
2321
  * Use the React `<MarkdownViewer>` component for client-side mermaid rendering.
2326
2322
  */
2327
2323
  async function renderMarkdown(content, options = {}) {
2328
- const { gfm = true, math = true, highlight = true, sourceLines = true, sanitize = true, frontmatter: parseFm = true } = options;
2324
+ const { gfm = true, math = true, highlight = true, sourceLines = true, sanitize = true, frontmatter: parseFm = true, tree } = options;
2329
2325
  let parsed;
2330
2326
  if (parseFm) parsed = parseFrontmatter(content);
2331
2327
  else parsed = {
@@ -2342,7 +2338,8 @@ async function renderMarkdown(content, options = {}) {
2342
2338
  sanitize,
2343
2339
  bodyLineOffset: parsed.bodyLineOffset
2344
2340
  });
2345
- const result = await (0, unified.unified)().use(remark_parse.default).use(remarkPlugins).use(remark_rehype.default, { allowDangerousHtml: true }).use(rehypePlugins).use(rehype_stringify.default).process(parsed.body);
2341
+ const processor = (0, unified.unified)().use(remark_parse.default).use(remarkPlugins).use(remark_rehype.default, { allowDangerousHtml: true }).use(rehypePlugins).use(rehype_stringify.default);
2342
+ const result = tree === void 0 ? String(await processor.process(parsed.body)) : processor.stringify(await processor.run(tree, parsed.body), parsed.body);
2346
2343
  return {
2347
2344
  html: String(result),
2348
2345
  frontmatter: parsed.frontmatter,