跳到正文
FunCoding

md-to-docx

Convert a Markdown file to DOCX (Word). Use when the user asks to convert .md to .docx, generate a Word document from Markdown, or export Markdown notes to Word.

Star
565
最近提交
2026年12月1日

content/skills/md-to-docx/SKILL.md

在 GitHub 上查看

md-to-docx — Markdown to DOCX conversion

Converts a Markdown file to a Word document (.docx) preserving headings, tables, lists, code blocks, links and inline images.

Usage

/md-to-docx <input.md> [output.docx] [--author "Name"] [--title "Title"] [--no-shading] [--justify]
ParameterRequiredDescription
input.mdyesPath to the source Markdown file
output.docxnoPath to the output file (default: alongside source, .md → .docx)
--authornoDocument author. Written to core properties (dc:creator + cp:lastModifiedBy). Also accepts the --author=Name form
--titlenoDocument title in core properties and in the header. Default: input file name without extension
--no-shadingnoDisables the grey background for inline code and fenced ``` code blocks. Alias: --shading=off. On by default. Does not affect the table header (it keeps its structural fill)
--justifynoJustifies body paragraphs and list items, including block quotes. Alias: --align=justify (also --align justify). Off by default; headings, code blocks, table cells and image captions keep their alignment

If the path is not provided — ask the user. The --author, --title, --no-shading, --justify flags are optional — pass them only when the user explicitly asks for an author, a custom title, removal of code shading, or justified text.

Dependencies

  • Node.js — to run the script
  • npm package docx — pinned by this skill's package-lock.json; install locally with npm ci --prefix "<skill-dir>"

Command

<skill-dir> below is the directory of this skill: content/skills/md-to-docx/ in the 1c-rules source repo, or <tool>/skills/md-to-docx/ after installation (e.g. .cursor/skills/md-to-docx/, .claude/skills/md-to-docx/).

PowerShell (Windows, default for this project):

npm ci --prefix "<skill-dir>"
node "<skill-dir>/scripts/md_to_docx.js" "<input.md>" "[output.docx]"

# With author and title
node "<skill-dir>/scripts/md_to_docx.js" "<input.md>" "[output.docx]" --author "I. Ivanov" --title "Analytical note"

# Without the grey code background
node "<skill-dir>/scripts/md_to_docx.js" "<input.md>" "[output.docx]" --no-shading

# With justified body text
node "<skill-dir>/scripts/md_to_docx.js" "<input.md>" "[output.docx]" --justify

Bash (macOS / Linux):

npm ci --prefix "<skill-dir>"
node "<skill-dir>/scripts/md_to_docx.js" "<input.md>" "[output.docx]"

Supported Markdown features

  • Headings (H1–H6) with styles and colors; a heading stays with the following paragraph (keepNext)
  • Tables with header row
  • Code blocks (monospace font, gray background)
  • Lists: bulleted and numbered (with nesting); wrapped continuation lines join the same item. Each numbered list, including nested lists and lists inside quotes, starts at its first source ordinal (4. starts at 4); subsequent markers such as repeated 1. continue that list. Blank lines between items keep a list together; a separate paragraph or another block ends it
  • Block quotes (>): marker stripped, wrapped lines joined, nested lists kept; left bar + indent
  • Paragraphs: hard-wrapped lines join until a blank line or the next block (heading, list, table, quote, fence, hr, image)
  • Inline formatting: bold, italic, code, links; code, links and italic nested inside bold (or code and links inside italic) keep both formats
  • Internal anchor links: <a id="name"></a> before a heading becomes a bookmark; [text](#name) links resolve to it (external http(s) / mailto: links stay external)
  • Images (![alt](path)) — resolved relative to the source MD folder; scaled down proportionally to fit the section's printable width and height, with room for paragraph spacing and one caption line (longer captions may continue on the next page)
  • Horizontal rules (---)
  • Headers/footers: title in the top, page number in the bottom
  • Core properties: author and title (via --author / --title)

If an image is not found — a red text placeholder is inserted.

Output example

Created: output.docx (45231 bytes, 42 blocks)

相似的 Skill

精选

pptx

生成、读取和修改演示文稿,也能合并拆分幻灯片。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

docx

创建和编辑 Word 文档,支持目录、页码、页眉等排版。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

pdf

提取文本和表格、合并拆分、填写表单,也能对扫描件做 OCR。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

doc-coauthoring

按步骤协作撰写技术方案、提案和决策文档,逐轮修改。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

xlsx

读写 Excel 和 CSV,处理公式、格式、图表与数据清洗。

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

canvas-design

按设计理念生成海报和视觉作品,输出 PNG 或 PDF。

ANanthropics/skills203k近 7 天新增 2,822 个 star