md-to-docx
它能做什么
这个工具可以把你用 Markdown(.md)格式写的文本,转换成排版专业的 Word(.docx)文档。它还会包含你在文本中引用的 PNG 图片。
适用场景
- ✓当你需要把草稿变成正式文档时。
- ✓需要根据标题自动生成目录时。
- ✓需要分享可以用 Word 打开的文档时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/md-to-docx/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把这个 Markdown 文件转换成 Word 文档:my_document.md”
每周 5 个新技能,1 分钟读完。
工作原理
你需要提供一个用 Markdown 编写的文本文件。工具会使用 Node.js 程序读取你的文本,识别标题、列表和图片,然后生成一个新的 Word(.docx)格式文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Markdown to Word (.docx) Skill
Convert Markdown (.md) files into professionally formatted Word (.docx) documents with embedded PNG images. Uses pure JavaScript via the docx and marked npm packages — no Pandoc, LibreOffice, or any native binary required.
How to Convert
# Install dependencies (one-time, from the scripts folder)
cd skills/md-to-docx/scripts && npm install
# Convert (run from workspace root)
node skills/md-to-docx/scripts/md-to-docx.mjs <input.md> [output.docx]
If output.docx is omitted, it defaults to <input-basename>.docx in the current directory.
Skill Folder Contents
| File | Purpose |
|---|---|
SKILL.md |
This instruction file |
scripts/md-to-docx.mjs |
Node.js Markdown-to-Word converter |
scripts/package.json |
Dependencies (docx, marked) |
Prerequisites
| Requirement | Version | Notes |
|---|---|---|
| Node.js | 18+ | Required runtime |
docx |
9+ | Pure JS Word document generator |
marked |
15+ | Markdown parser |
No native binaries. No system-level installs. Works on Windows, macOS, and Linux.
Features
The converter:
- Extracts YAML front-matter — uses
title,date,version,audiencefor the title page - Generates a title page — with project name, subtitle, date, version, and audience
- Generates a table of contents — built from H1-H3 headings
- Embeds PNG images — resolves
references relative to the input.mdfile, reads the PNG, and embeds it inline in the Word document - Styled output — Calibri font, colored headings (
#1F3864), styled tables with alternating row colors, code blocks in Consolas - Handles all Markdown elements — headings, paragraphs, tables, code blocks, lists, images, links, horizontal rules
Image Embedding
The converter automatically embeds PNG images referenced in the Markdown:

The image path is resolved relative to the input Markdown file. The PNG is read, dimensions are extracted from the PNG header, and the image is scaled to fit within 6 inches width while preserving aspect ratio.
If an image file is not found, a placeholder [Image not found: <path>] is inserted.
Front-Matter Format
---
title: Project Name — Project Summary
date: 2025-01-15
version: 1.0
audience: Engineering Team, Architects, Stakeholders
---
The title is split on — or – into main title and subtitle for the title page.
常见问题
我需要安装复杂的东西吗?
你的电脑需要先安装 Node.js。其余部分在运行安装命令时会自动完成设置。
如果文本中有图片怎么办?
如果图片是 PNG 格式,并且与你的 Markdown 文件位于同一位置或相关文件夹中,就会被包含在 Word 文档里。
什么是“YAML 前置元数据”?
它是 Markdown 文件开头的一小段文字,位于两条三短横线(---)之间。你可以在这里填写标题、日期、目标读者等信息,用于生成 Word 文档。
详情
作者的原始描述
Convert Markdown files to professionally formatted Word (.docx) documents with embedded PNG images — pure JavaScript, no external tools required
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7285
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。