md2nativedocx

免费开源 · 公有领域

引擎, 用在您自己的代码里

扩展、MCP 服务器和本网站背后的库,发布在 npm 上并属于公有领域:把单个图表渲染为 Word XML,在 Node 中转换整份文档,或把图表接入您自己的 Pandoc 命令。

功能

开始使用

  1. npm install @md2nativedocx/core 用于逐个渲染图表,或 @md2nativedocx/cli 用于整份文档(需安装 Pandoc)。

  2. 每个导出的函数和类型都在其包中有文档说明:编辑器会在您输入时显示。

  3. 代码属于公有领域(CC0-1.0)。其架构和所遵循的安全规则都在 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);

使用 md2nativedocx 的其他方式