Markdown to Word
Convert Markdown files into styled Word .docx documents directly from the VS Code right-click menu.
中文文档
Quick Start
- Select a
.md file in the VS Code Explorer or open it in the editor.
- Right-click and choose Convert to Word Document.
- The generated
.docx file is saved next to the source Markdown file.
Features
- Headings from level 1 to level 5
- Bold, italic, strikethrough, inline code, links, and blockquotes
- Ordered, unordered, and nested lists
- Tables with document-friendly styling
- Code blocks with a readable shaded style
- LaTeX-style math formulas
- Local and remote images with automatic width scaling
- Chinese-oriented Word typography with sensible English font fallback
Word Styling
The generated document applies a consistent academic/document style:
| Element |
Chinese Font |
English Font |
Size |
Alignment |
Notes |
| Heading 1 |
黑体 |
Times New Roman |
16 pt |
Center |
Bold |
| Heading 2 |
黑体 |
Times New Roman |
14 pt |
Left |
Bold |
| Heading 3-5 |
黑体 |
Times New Roman |
12 pt |
Left |
Bold |
| Body |
宋体 |
Times New Roman |
12 pt |
Justified |
First-line indent |
| Table text |
宋体 |
Times New Roman |
10.5 pt |
Center |
Clean table layout |
| Code block |
宋体 |
Times New Roman |
12 pt |
Left |
Shaded background |
Markdown Examples
Math
Inline math: $E = mc^2$
$$
\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$
Table
| Column A | Column B | Column C |
| --- | --- | --- |
| A1 | B1 | C1 |
| A2 | B2 | C2 |
Troubleshooting
The right-click command is missing.
Make sure the file language is Markdown and the file extension is .md.
Conversion failed.
Check that the Markdown file is encoded as UTF-8 and that referenced local images exist.
Can I customize the Word styles?
The current version uses built-in styles. You can adjust the generated document in Word after conversion.
Does it support batch conversion?
The current version converts one Markdown file at a time.
中文说明
在 VS Code 中通过右键菜单,将 Markdown 文件转换为带排版样式的 Word .docx 文档。
English README
快速开始
- 在 VS Code 资源管理器中选择
.md 文件,或在编辑器中打开 Markdown 文件。
- 右键点击,选择 转换为 Word 文档。
- 生成的
.docx 文件会保存到 Markdown 文件所在目录。
功能特性
- 支持 1 到 5 级标题
- 支持粗体、斜体、删除线、行内代码、链接和引用
- 支持有序列表、无序列表和嵌套列表
- 支持表格,并自动应用适合文档的表格样式
- 支持代码块,并使用清晰的灰色背景样式
- 支持 LaTeX 风格数学公式
- 支持本地和远程图片,并自动按页面宽度缩放
- 默认应用适合中文文档的 Word 排版样式
Word 排版样式
生成的 Word 文档会自动应用统一的文档排版:
| 元素 |
中文字体 |
英文字体 |
字号 |
对齐 |
说明 |
| 一级标题 |
黑体 |
Times New Roman |
16 pt |
居中 |
加粗 |
| 二级标题 |
黑体 |
Times New Roman |
14 pt |
左对齐 |
加粗 |
| 三至五级标题 |
黑体 |
Times New Roman |
12 pt |
左对齐 |
加粗 |
| 正文 |
宋体 |
Times New Roman |
12 pt |
两端对齐 |
首行缩进 |
| 表格文字 |
宋体 |
Times New Roman |
10.5 pt |
居中 |
清晰表格样式 |
| 代码块 |
宋体 |
Times New Roman |
12 pt |
左对齐 |
灰色背景 |
Markdown 示例
数学公式
行内公式:$E = mc^2$
$$
\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$
表格
| 列 A | 列 B | 列 C |
| --- | --- | --- |
| A1 | B1 | C1 |
| A2 | B2 | C2 |
常见问题
找不到右键菜单怎么办?
请确认文件语言是 Markdown,且文件扩展名为 .md。
转换失败怎么办?
请检查 Markdown 文件是否为 UTF-8 编码,以及引用的本地图片是否存在。
可以自定义 Word 样式吗?
当前版本使用内置样式。生成 Word 后,可以在 Word 中继续手动调整。
支持批量转换吗?
当前版本一次转换一个 Markdown 文件。