Markdown to Word With Images
Paste the following prompt into your AI chat to install this skill:
Please install @user_29e2fa9e/md-to-docx-with-images using https://skillhub.cn/install/skillhub.md.
About this skill
Problem
Exporting Markdown to Word is rarely about producing a .docx file at all. The practical pain is that images are not embedded, headings do not map to Word heading styles, table formatting drifts, and image captions are left as plain body-text paragraphs. Driving pandoc manually can work, but it requires dependency checks, relative image-path validation, and a post-processing pass for captions, which is easy to skip.
How It Works
The skill turns conversion into a repeatable workflow: pandoc performs the core conversion, while scripts/check_images.py verifies that image references point to real files before conversion. scripts/md_to_docx.py then converts the Markdown document to .docx and normalizes image captions so they are centered, 8pt, and not italicized. If pandoc is missing, it attempts automatic installation and reminds the user to refresh the terminal; for manual pandoc runs, scripts/fix_captions.py can repair captions in an existing document.
- Image embedding: supports local relative paths and remote URLs, with pre-conversion path checks
- Style preservation: Markdown headings map to Word heading styles, and bold or italic text is largely preserved
- Reference documents:
--reference-doccan control heading fonts, table styles, spacing, and margins - Caption cleanup: converts Pandoc’s default caption paragraphs into a cleaner caption style
Limits
This is not a pure Python document generator; pandoc is required. Complex Word tables may lose merged cells or nested structures through a docx -> md -> docx round trip, and table-of-contents entries can degrade into plain links or text. .emf images may embed but render inconsistently across platforms. It fits best for exporting well-structured Markdown files with clean image paths into distributable Word documents.
Use Cases
- Export Markdown reports with local images to Word while preserving headings, tables, and captions.
- Validate relative image paths before generating a distributable .docx from Markdown.
- Apply a reference DOCX template to control heading fonts, table styles, and margins.
- Normalize Pandoc-generated image captions to centered 8pt non-italic text.
Best For
- Docs engineers who need to export image-rich Markdown into Word for review.
- Product managers who want consistent headings, tables, and captions in Word reports.
- Operations staff who need to turn local-image Markdown files into shareable Word documents.
- Pandoc pipeline users who want image-path checks and normalized caption styling.
Related Skills
Runs rule and semantic checks on Word files, adds comments, and applies GB/T 9704-2012 party/government formatting.
Generate professional .pptx presentations from a topic or outline, with themes, common layouts, speaker notes, and 16:9/4:3 support.
Generates a fixed-structure A-share tech daily across five tracks, screening 24-hour news and selecting leader and growth stocks.
Convert teaching schedules from talent development plan PDFs into structured Excel files, with cross-page tables, merged cells, multi-semester course splitting, major metadata extraction, and batch output.