Free and open source · public domain
The libraries behind the extension, the MCP server and this site, on npm and in the public domain: render one diagram as Word XML, convert a whole document from Node, or bring the diagrams into your own Pandoc command.
renderDiagram() turns one Mermaid or PlantUML diagram into Word XML: shapes, SmartArt or a chart, with the parts it needs. TypeScript, no Pandoc, in Node or a browser.
convert() writes a whole .docx or .odt from Markdown, as a Buffer, with every option of the command line. Pandoc must be installed.
exportPptx() turns the Mermaid blocks of a Markdown text into a .pptx, one slide per diagram, as shapes you can edit.
The Lua filter the command line runs inside Pandoc. On its own, pandoc -L md2nativedocx.lua draws the diagrams as shapes; SmartArt and Word charts need the command line.
npm install @md2nativedocx/core to render one diagram at a time, or @md2nativedocx/cli for whole documents (with Pandoc installed).
Every exported function and type is documented in its package: your editor shows it as you type.
The code is in the public domain (CC0-1.0). Its architecture and the security rules it follows are on GitHub.
// One diagram, no Pandoc: a Word fragment and the parts it needs
import { renderDiagram } from '@md2nativedocx/core';
const { kind, fragment, parts } = renderDiagram('flowchart LR\n A --> B');
// A whole document, Pandoc installed: the .docx as a Buffer
import { convert } from '@md2nativedocx/cli';
const { document, warnings } = await convert('# Report\n\n…');
// One slide per Mermaid block: the .pptx as a Buffer
import { exportPptx } from '@md2nativedocx/pptx';
const { buffer } = await exportPptx(markdown);