I converted the report and saved it as .claude/skills/md-to-docx/sample/report.docx (11 KB). The dependencies installed with only an engine warning: nanoid wants Node 22 or later and this machine has v20.19.0. The conversion ran fine anyway. The description below comes from the document XML, not just the script's success message.
What the document contains
- Title page: "Q3 Platform Review" as the title, "Summary for Engineering" as the subtitle, then "Date: 2026-10-01 | Version: 1.2" and "Audience: Engineering, Product". It is followed by a page break.
- Table of contents: It lists Highlights, Key numbers (indented as a sub-entry) and Plan, then a page break.
- Sections:
- Highlights (heading 2) has a paragraph with bold "18%", italic "0.2%",
status.mdin Consolas with a grey background, and "the dashboard" in blue underline. - Key numbers (heading 3) holds the table.
- Plan (heading 2) has the numbered list "1. Migrate the queue" and "2. Add retries", with "exponential backoff" and "jitter" as indented bullets.
- A Python code block follows, in Consolas on a grey background.
- The document ends with the Chinese paragraph (中文段落:延迟下降 18%。), a horizontal rule and "Done."
- Highlights (heading 2) has a paragraph with bold "18%", italic "0.2%",
- Table: It has 3 columns (Metric, Q2, Q3) and 2 data rows, p95 latency (420 → 344) and Error rate (0.3% → 0.19%). The header row is shaded and repeats across pages, and the rows alternate in colour.
- Image:
diagrams/arch.pngis embedded, centred, with the caption "Architecture".
What did not convert cleanly
- Missing image:
diagrams/nope.pngwas not found, so the document has the placeholder text[Image not found: diagrams/nope.png]. - Mermaid diagram: It was not rendered. The document has the placeholder "[Diagram: See source .md file for interactive Mermaid diagram]".
- Tiny image: The embedded architecture image is only about 0.4 × 0.2 inches (381000 × 190500 EMU). The source PNG is probably a tiny placeholder, so it will look very small in Word.
- Dropped H1: The
# Q3 Platform Review — Summary for Engineeringheading does not appear in the body or the table of contents. Its text is only on the title page. - Link has no URL: "the dashboard" is styled as a link, but there is no hyperlink element in the file, so the
https://example.com/dashURL is lost. - Static table of contents: It is plain text with no page numbers and no links, so it won't update in Word.
- Fake lists: The list markers ("1.", "•") are typed characters with indentation, not real Word lists.
- Code language dropped: The code block keeps its text but not the
pythonlanguage tag, and there is no syntax highlighting. - Chinese font: The Chinese text is set in Calibri, which has no CJK glyphs, so Word will substitute a fallback font. I didn't check how it looks.
How it was tried: the Skill needs npm dependencies, so I had the model run the documented npm install first, then convert a sample Markdown file I built (cover metadata, tables, nested lists, code blocks, a PNG image, one deliberately missing image, a Mermaid code block and a Chinese paragraph). Bash was allowed only for npm install, the conversion command and inspecting the docx internal XML. I also unzipped the docx by hand to check, and the model's description matched. The sample PNG is only a 40x20-pixel placeholder, which is why the text says it is tiny in the document.
它做什麼
執行隨附的 Node.js 腳本,藉由 docx 與 marked 兩個 npm 套件把 .md 檔轉成 .docx,不需要 Pandoc 或 LibreOffice。它讀取 YAML 前置資訊(標題、日期、版本、讀者)產生封面,依 H1 到 H3 標題產生目錄,為標題、隔行變色的表格與程式碼區塊設定樣式,處理清單、連結與分隔線,並嵌入 Markdown 中引用的 PNG 圖片(路徑相對於該檔案,縮放到約 6 英吋寬)。Mermaid 區塊會變成一行預留文字。
運作方式
- 在 scripts 資料夾中一次性執行
npm install。 - 執行
node md-to-docx.mjs input.md [output.docx];未指定輸出名稱時,會在目前目錄依輸入檔名產生。
適合什麼場景
把用 Markdown 寫的文件、規格說明與報告轉成 Word 檔以便分享。
中風險:它執行一個 Node 腳本,需要 `npm install`(下載 `docx` 與 `marked`)。它把 `.docx` 寫到輸出路徑,同名檔案會被直接取代而不詢問,請改用新名稱或先備份。Markdown 中的圖片路徑是相對輸入檔解析的,沒有限制在該資料夾內,也不檢查是否為 PNG,因此轉換來源不明的 Markdown 可能把磁碟上其他檔案嵌進文件。腳本不發出網路請求。已試用,轉換結果正確。限制:連結只保留文字、不保留網址;目錄是靜態文字,沒有頁碼與跳轉;清單是用字元模擬的;只嵌入 PNG,其他圖片格式會被當作 PNG 寫入,可能無法顯示。