返回资讯中心
外部精选
软件工程
#开发者实时流

Show HN: Md2docx – Compile Markdown directly into native Word documents

🚀 Md2Docx — Pluggable Engine with Rich Official Plugin EcosystemMarkdown to Word Native, Modular, Extensible

Hacker News 最新mayank15132026/11/4 · 今天27 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Search⌘K

🚀 Md2Docx — Pluggable Engine with Rich Official Plugin EcosystemMarkdown to Word Native, Modular, Extensible

Convert Markdown into native, editable Word (.docx) documents in browsers or Node.js. Modular by design — cherry-pick official plugins, or easily author your own.

Launch Live PlaygroundDocumentationGitHubGitHub

Zero-Config CLI— Instant Document Compilation

npxpnpmbunx

$npx @m2d/cli report.md -o report.docx

Interactive Playground & Engine Showcase

Pluggable Architecture & Official Plugin Ecosystem

Select your compilation target, toggle our rich suite of official plugins, or wire custom AST transformers to export native Microsoft Word (.docx) documents in real-time.

Official Plugin Suite (Pluggable Pipeline):8 of 8 Active

Enable All|Disable All

@m2d/frontmatter

YAML/TOML Document Properties

@m2d/math

LaTeX Equations ($...$, $$...$$)

@m2d/mermaid

Flowcharts & Sequence diagrams

@m2d/image

Browser Images & SVGs

@m2d/table

GFM Tables & Alignments

@m2d/list

Numbered & Bulleted Trees

@m2d/html

HTML Markup (<kbd>, <mark>, etc.)

@m2d/emoji

GitHub Shortcodes & Twemoji

Frontmatter Layout Synthesizer:Automatically render styled cover sections or callout boxes from YAML/TOML

Cover Page Info-Box Banner ✓

Preset:Showcase (All Plugins)Architecture SpecAcademic PaperExecutive BriefMath EquationsMermaid DiagramsTables & DataFull Reference (sample.md)

Presets:Showcase (All Plugins)Architecture SpecAcademic PaperExecutive BriefMath EquationsMermaid DiagramsTables & DataFull Reference (sample.md)

MarkdownLive PreviewWord (.docx) PreviewWYSIWYG (Tiptap)Doc PropertiesImplementation Code

MarkdownLive PreviewWord (.docx)WYSIWYGPropertiesCode

Target:

@m2d/md2docx (All-in-One)mdast2docx (Core AST)Remark Plugin (Unified Plugin)

All-in-One

321 words|~2 pages

7 headings1 table5 formulas1 diagram


title: "md2docx Feature Showcase" author: "Mayank Chaudhari" description: "A complete demonstration of Markdown to native DOCX conversion" keywords: "docx, markdown, openxml, remark"

md2docx Feature Showcase

A balanced, complete demonstration of standard Markdown, GitHub Flavored Markdown (GFM), math formulas, diagrams, tables, and rich HTML tags converted into a native Microsoft Word (.docx) document.

1. Mathematical Formulas (@m2d/math)

Inline equation: Einstein's mass-energy equivalence is $E = mc^2$. Pythagorean theorem: $a^2 + b^2 = c^2$.

Display integral equation: $$ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} $$

Euler's identity: $$ e^{i\pi} + 1 = 0 $$

Quadratic formula: $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$

2. Mermaid Diagram (@m2d/mermaid + @m2d/image)

graph LR
 A["Markdown Source"] --> B["Unified / Remark Parser"]
 B --> C["Extended MDAST Tree"]
 C --> D["Plugin Pipeline"]
 D --> E["@m2d/core Converter"]
 E --> F["docx Document (.docx)"]

3. Data Tables (@m2d/table)

Plugin Package Category Execution Target Status
@m2d/core Engine Universal (Browser + Node) Stable
@m2d/math Plugin Word MathRuns / Equations Active
@m2d/mermaid Plugin SVG to Raster Embedding Active
@m2d/table Plugin OpenXML Tables & Alignments Active
@m2d/list Plugin Numbered & Bulleted Hierarchies Active
@m2d/html Plugin Raw HTML to DOCX Elements Active
@m2d/image Plugin Browser Image / Canvas Rasterizer Active
@m2d/image-node Plugin Node.js / Sharp Image Rasterizer Active

4. Nested Hierarchical Lists (@m2d/list)

  1. Engine Architecture
  • Core AST parsing
  • Section configuration
  1. Plugin Ecosystem
  2. Graphic Renderers
  • Mermaid Diagrams
  • Math LaTeX
  1. Typography
  • Rich HTML styling
  • Custom bullet sets

5. Inline HTML & Styling (@m2d/html)

Press <kbd>Ctrl</kbd> + <kbd>P</kbd> to export or inspect. Status: <span style="color: #16a34a; font-weight: bold;">● Live & Ready</span> Important note: <mark style="background-color: #fef08a;">Highlighted text rendered directly in Word</mark>.

6. Embedded Graphics (@m2d/image)

Sample Badge

Rendered with @m2d/react-markdown

Preview render: measuring...

Document Overview

Author: Mayank Chaudhari

md2docx Feature Showcase

A balanced, complete demonstration of standard Markdown, GitHub Flavored Markdown (GFM), math formulas, diagrams, tables, and rich HTML tags converted into a native Microsoft Word (.docx) document.

Inline equation: Einstein's mass-energy equivalence is E=mc2E = mc^2E=mc2. Pythagorean theorem: a2+b2=c2a^2 + b^2 = c^2a2+b2=c2.

​​ 2. Mermaid Diagram (@m2d/mermaid + @m2d/image)

Mermaid Diagram

DiagramCode

Copy

Rendering diagram...

  1. Data Tables (@m2d/table)

Plugin PackageCategoryExecution TargetStatus@m2d/coreEngineUniversal (Browser + Node)Stable@m2d/mathPluginWord MathRuns / EquationsActive@m2d/mermaidPluginSVG to Raster EmbeddingActive@m2d/tablePluginOpenXML Tables & AlignmentsActive@m2d/listPluginNumbered & Bulleted HierarchiesActive@m2d/htmlPluginRaw HTML to DOCX ElementsActive@m2d/imagePluginBrowser Image / Canvas RasterizerActive@m2d/image-nodePluginNode.js / Sharp Image RasterizerActive 4. Nested Hierarchical Lists (@m2d/list)

Engine Architecture

Core AST parsing

Section configuration

Plugin Ecosystem

Graphic Renderers

Mermaid Diagrams

Math LaTeX

Typography

Rich HTML styling

Custom bullet sets

  1. Inline HTML & Styling (@m2d/html)

Press <kbd>Ctrl</kbd> + <kbd>P</kbd> to export or inspect. Status: <span style="color: #16a34a; font-weight: bold;">● Live & Ready</span> Important note: <mark style="background-color: #fef08a;">Highlighted text rendered directly in Word</mark>.

Click compile below to execute with selected target & plugins

Browser (Blob)Node.js API

Export DOCX (Browser)

Engineered for Modern Workflows

Why Developers & Enterprises Choose Md2Docx

A purpose-built document compiler that balances lightweight frontend privacy with robust server-side automation.

Client & Server

Universal Dual Execution

Compile 100% in the browser with WebAssembly & JS for zero latency and complete data privacy, or stream headlessly in Node.js backends and serverless workers.

Clean OpenXML

Native OpenXML Fidelity

Translates Markdown AST nodes into genuine Microsoft Word structures — native MathML equations, editable tables, vector graphics, and true outline numbering.

Pluggable & Extensible

Pluggable Core & Rich Official Plugins

Engineered on the Unified & Remark AST ecosystem. Leverage our comprehensive suite of official plugins or write custom plugins.

Turn YAML/TOML frontmatter into professional title pages, divider rules, author metadata lines, page breaks, and callout banners with zero manual markup.

CLI Automation

Zero-Config Terminal CLI

Run instant document compilation via npx @m2d/cli or in CI/CD release pipelines with structured logging, configuration files, and multiple binary aliases.

AI Ready

Generative AI Document Bridge

Transform raw Markdown output from ChatGPT, Claude, and Gemini into corporate-ready Word deliverables with robust self-healing and error resiliency.

See how Md2Docx stacks up against traditional CLI binaries, imperative libraries, and HTML wrappers.

Yes (0ms network, full privacy)No (native binary required)Yes (client-side only)Yes (limited DOM)Markdown / MDAST FirstNative AST parsing & transformsYes (internal AST)Manual imperative code onlyHTML parsing onlyZero Binary DependenciesPure TypeScript / JavaScriptRequires Haskell/C++ binaryPure JavaScriptPure JavaScriptLaTeX Equations to OMMLNative Word Math elementsRequires LaTeX engineManual MathRuns requiredNot supportedMermaid to Embedded VectorAutomatic SVG + self-healingRequires external filter / CLIManual image buffersNot supportedExtensible Plugin PipelineStandard Unified / Remark pluginsLua filtersImperative function wrappersNoneServerless & Edge ReadyLightweight (~35-40kB core)Heavy container footprintLightweightLimited support

20 Purpose-Built Packages

The Md2Docx Modular Ecosystem

Organized into clear architectural layers — start with high-level batteries-included entry points, or cherry-pick lightweight scoped plugins for microservices and edge runtimes.

Quickstart Entry

Universal

@m2d/md2docx

All-in-one batteries-included Markdown to DOCX converter with zero configuration.

Quickstart Entry

Node.js

@m2d/cli

Zero-config terminal CLI and headless batch document generation engine.

Quickstart Entry

Universal

mdast2docx

Complete all-in-one distribution bundle pre-wired with all official plugins.

Framework Extension

Browser

@m2d/tiptap

Client-side DOCX export extension for Tiptap 3 / ProseMirror with frontmatter preservation.

Framework Extension

Universal

@m2d/react-markdown

SSR-friendly React Markdown renderer that captures AST for instant Word export.

Unified Compiler

Browser

@m2d/remark-docx

Official Unified/Remark compiler plugin for direct in-browser DOCX generation.

Unified Compiler

Node.js

@m2d/remark-docx-node

Server-side Remark compiler plugin with native Sharp and beautiful-mermaid rasterization.

Content Plugin

Universal

@m2d/frontmatter

Parses YAML/TOML front-matter metadata into docxProps, cover pages, and info-boxes.

Content Plugin

Universal

@m2d/table

Rich GFM tables with custom borders, cell padding, repeating headers, and background shading.

Content Plugin

Universal

@m2d/math

LaTeX math equations translated directly into native editable Word OMML MathML.

Content Plugin

Browser

@m2d/mermaid

Browser Mermaid diagrams with SVG extraction and self-healing syntax error repair.

Content Plugin

Node.js

@m2d/mermaid-node

Headless server-side Mermaid renderer powered by beautiful-mermaid with zero browser dependencies.

Content Plugin

Browser

@m2d/html

Converts HTML tags, inline CSS styles, and <style> block stylesheets into styled OpenXML nodes.

Content Plugin

Node.js

@m2d/html-node

Lightweight server-side HTML parser powered by LinkeDOM without heavy JSDOM overhead.

Content Plugin

Browser

@m2d/image

Browser image rasterization with IndexedDB caching and collapsible code block fallbacks.

Content Plugin

Node.js

@m2d/image-node

Server-side image rasterizer powered by Sharp with authentic Word code block fallbacks.

Content Plugin

Universal

@m2d/list

Hierarchical decimal numbering (1.1.1) and custom nested bullet glyphs.

Core Engine

Universal

@m2d/core

Foundational AST-to-OpenXML compiler, plugin pipeline, and warnings deduplication.

Core Engine

Universal

@m2d/cache

Persistent xxhash-wasm and IndexedDB caching engine for rasterized diagrams and assets.

Core Engine

Universal

@m2d/mdast

TypeScript types and schemas for extended MDAST OpenXML nodes and properties.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →