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/index.cjs CHANGED
@@ -1271,10 +1271,6 @@ function errorPosition(error) {
1271
1271
  //#endregion
1272
1272
  //#region src/renderMarkdown.ts
1273
1273
  /**
1274
- * Framework-agnostic markdown -> HTML rendering pipeline.
1275
- * Uses the same remark/rehype chain as the Vantage viewer.
1276
- */
1277
- /**
1278
1274
  * Render a markdown string to HTML using the full Vantage pipeline.
1279
1275
  *
1280
1276
  * Features (all enabled by default):
@@ -1291,7 +1287,7 @@ function errorPosition(error) {
1291
1287
  * Use the React `<MarkdownViewer>` component for client-side mermaid rendering.
1292
1288
  */
1293
1289
  async function renderMarkdown(content, options = {}) {
1294
- const { gfm = true, math = true, highlight = true, sourceLines = true, sanitize = true, frontmatter: parseFm = true } = options;
1290
+ const { gfm = true, math = true, highlight = true, sourceLines = true, sanitize = true, frontmatter: parseFm = true, tree } = options;
1295
1291
  let parsed;
1296
1292
  if (parseFm) parsed = parseFrontmatter(content);
1297
1293
  else parsed = {
@@ -1308,7 +1304,8 @@ async function renderMarkdown(content, options = {}) {
1308
1304
  sanitize,
1309
1305
  bodyLineOffset: parsed.bodyLineOffset
1310
1306
  });
1311
- 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);
1307
+ const processor = (0, unified.unified)().use(remark_parse.default).use(remarkPlugins).use(remark_rehype.default, { allowDangerousHtml: true }).use(rehypePlugins).use(rehype_stringify.default);
1308
+ const result = tree === void 0 ? String(await processor.process(parsed.body)) : processor.stringify(await processor.run(tree, parsed.body), parsed.body);
1312
1309
  return {
1313
1310
  html: String(result),
1314
1311
  frontmatter: parsed.frontmatter,