AI Agent Hub
Back to skills
Markdown Word Bidirectional Converter icon

Markdown Word Bidirectional Converter

Office Efficiency Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_27f88699/md2docx.

About this skill

Problem

When Markdown is used for drafting and Word is used for delivery, copying text by hand often breaks the document. Heading levels, code blocks, tables, inline code, images, Mermaid diagrams, and merged cells can become misaligned or lost. md2docx addresses this by converting between .md and .docx files and automatically choosing the direction from the file extension.

How It Works

  • MD to DOCX: The output uses Chinese-friendly formatting, with Microsoft YaHei for body text at 10.5pt and tables at 9pt. Headings are scaled by level, starting around 12.5pt at the lowest level and increasing by 2pt per level. Code blocks are rendered with a gray background, four borders, and the Consolas monospaced font. Bold, italics, inline code, links, blockquotes, horizontal rules, images, and HTML blocks are also handled.
  • Tables and merged cells: Standard Markdown tables do not support rowspan or colspan, so the skill uses HTML table embedding. This keeps merged-cell layouts visible in common Markdown renderers and helps preserve the structure when converting back or parsing DOCX content.
  • Diagrams and dependencies: Mermaid code can be rendered into PNG images and embedded in Word. The script detects system Chrome, Edge, or Chromium when available. If Node.js or Python packages such as python-docx, mammoth, or beautifulsoup4 are missing, some features degrade, for example Mermaid may fall back to a text placeholder and syntax highlighting may become plain text.

Boundaries

This is useful for personal documents, technical notes, report drafts, and preparing Markdown content for Word delivery. It is not a full layout engine: complex Word styles, headers and footers, fields, equations, and other unspecified features may not be preserved exactly. Documents with many merged cells should use HTML tables where possible. If only plain text conversion is needed, Mermaid and Node-related setup can be ignored.

Use Cases

  • A technical writer converts Markdown design docs with code blocks, tables, and Mermaid into review-ready Word deliverables for stakeholder feedback.
  • A product manager converts Word requirements with headings, lists, and merged cells back to Markdown for Git-based version control workflows.
  • An engineer exports Markdown API notes containing HTML tables to Word while preserving header styling and merged-cell structure for client delivery.
  • A docs maintainer extracts inline images and Mermaid blocks from Word into Markdown for archive, review, and future rendering cycles.

Best For

  • Engineers who deliver technical Markdown as Word and need code blocks, tables, and Mermaid preserved.
  • Product managers who move Word requirements into Git and need headings, lists, and merged cells extracted.
  • Technical writers who maintain API notes across Markdown and Word and rely on HTML merged-table fidelity.
  • Docs maintainers who archive illustrated documents and need inline image references and Mermaid blocks preserved.