Skip to main content
docx-to-md Convert Word documents (.docx) to clean Markdown with image extraction and pandoc cleanup
Jump to install Skills Marketplace Discover and explore AI skills built by the community.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Copy promptShow prompt details A direct command skips the review prompt. Inspect the source before running it.
npx skills add https://github.com/fabioc-aloha/Alex_Plug_In --skill docx-to-mdThe command stays on one line. Scroll horizontally to inspect it before copying.
Prefer a local copy? Download the files currently available to SkillsMP.
Download Zip Downloading... More from this repository Based on SOC occupation classification
name docx-to-md description Convert Word documents (.docx) to clean Markdown with image extraction and pandoc cleanup tier extended inheritance inheritable applyTo **/*.docx,**/*word*,**/*docx* muscle .github/muscles/docx-to-md.cjs
Word to Markdown Conversion
Ingest Word documents into your Markdown workflow โ clean, linted, version-control ready
Convert .docx files into clean, linted Markdown with extracted images, normalized headings, and cleaned table formatting. The reverse converter for ingesting external documents into a Markdown-based workflow.
When to Use
Importing Word documents from stakeholders into a Markdown-based workflow
Converting legacy documentation to Markdown for version control
Extracting content from .docx for further processing (presentations, email, web)
Onboarding external resources (SOWs, RFPs, specs) into project repositories
Migrating from Word-based documentation to docs-as-code
Preparing content for static site generators (VitePress, Docusaurus, etc.)
Supported Content Content Type Status Notes Headings โ
Hierarchy normalized to start at H1 Bold/Italic โ
Converted to Markdown syntax Links โ
Preserved as Markdown links Images โ
Extracted to images/ folder Tables โ
Cleaned and aligned Lists โ
Ordered, unordered, nested Code blocks โ ๏ธ Detected if styled as code Footnotes โ
Converted to Markdown footnotes Comments โ ๏ธ Stripped with --strip-comments Track changes โ Accept/reject before converting Embedded objects โ Extract manually
Key Features Feature Details Image extraction Embedded images saved to images/ folder with sequential naming Pandoc cleanup Removes escaped brackets, span classes, trailing backslashes Table normalization Aligns columns, adds proper separators Heading fix Normalizes hierarchy to start at H1 Frontmatter Optional YAML frontmatter with title and date Comment stripping Removes Word review comments
Usage
node .github/muscles/docx-to-md.cjs report.docx
node .github/muscles/docx-to-md.cjs spec.docx --add-frontmatter --fix-headings
node .github/muscles/docx-to-md.cjs reviewed.docx --strip-comments
node .github/muscles/docx-to-md.cjs input.docx output/document.md
node .github/muscles/docx-to-md.cjs input.docx --debug
node .github/muscles/docx-to-md.cjs spec.docx --add-frontmatter --fix-headings --strip-comments --clean-tables
Options Reference Option Default Description --extract-imagestrue Extract images to images/ folder --no-extract-images- Keep images as raw base64 in markdown --add-frontmatteroff Generate YAML frontmatter with title/date --clean-tablestrue Normalize table column widths --no-clean-tables- Keep pandoc raw table output --fix-headingsoff Normalize heading hierarchy to start at H1 --wrap N0 Wrap lines at N characters (0 = no wrap) --strip-commentsoff Remove Word comment annotations --debugoff Keep intermediate pandoc output
Post-Processing Pipeline The conversion follows a multi-stage cleanup:
.docx โ pandoc โ raw MD โ cleanup โ clean MD
โ
1. Escaped brackets removed
2. Trailing backslashes removed
3. Span classes stripped
4. Image attributes cleaned
5. Comments stripped (optional)
6. Headings normalized (optional)
7. Tables reformatted
8. Images extracted
9. Frontmatter added (optional)
Pandoc Cleanup Details Pandoc Quirk Before After Escaped brackets \[text\][text]Trailing backslashes line\lineSpan classes {.underline}(removed) Image attributes {width="5in"}(removed) Heading anchors {#section-1}(removed) Excessive blank lines \n\n\n\n\n\n
Image Extraction Embedded images are extracted to a sibling images/ folder:
input/
โโโ document.docx
โโโ document.md (output)
โโโ images/
โโโ image1.png
โโโ image2.png
โโโ image3.jpg
Image references in markdown are updated automatically:
Common Workflows
Stakeholder Document Ingestion
node .github/muscles/docx-to-md.cjs stakeholder-spec.docx \
--add-frontmatter --fix-headings --strip-comments
node .github/muscles/markdown-lint.cjs stakeholder-spec.md
git add stakeholder-spec.md images/
git commit -m "docs: ingest stakeholder specification"
Legacy Documentation Migration
Get-ChildItem *.docx | ForEach-Object {
node .github/muscles/docx-to-md.cjs $_ .FullName --add-frontmatter --fix-headings
}
Troubleshooting Problem Cause Solution "pandoc not found" pandoc not installed winget install pandocImages missing Extraction failed Check images/ folder, re-run Tables misaligned Complex table structure Manual cleanup may be needed Headings start at H3 Original doc structure Use --fix-headings Comments in output Track changes not stripped Use --strip-comments Encoding issues Non-UTF8 content Re-save .docx as UTF-8
Limitations
Track changes : Accept or reject all changes in Word before converting
Embedded objects : Charts, SmartArt, etc. must be extracted manually
Complex tables : Merged cells may not convert cleanly
Styles : Word styles are lost (only structural elements preserved)
Headers/footers : Not extracted (document body only)
Requirements
Node.js 18+
pandoc (winget install pandoc)
Muscle Script .github/muscles/docx-to-md.cjs (v1.0.0)
Related Skills
md-to-word โ Reverse direction (Markdown to Word)
lint-clean-markdown โ Post-validate converted Markdown
md-scaffold โ Template for structuring imported content
md-to-html โ Convert result to HTML for web
md-to-eml โ Convert result to email
Skill version: 2.0.0 | Last updated: 2026-04-14 | Category: document-conversion
The conversion follows a multi-stage cleanup:
.docx โ pandoc โ raw MD โ cleanup โ clean MD
โ
1. Escaped brackets removed
2. Trailing backslashes removed
3. Span classes stripped
4. Image attributes cleaned
5. Comments stripped (optional)
6. Headings normalized (optional)
7. Tables reformatted
8. Images extracted
9. Frontmatter added (optional)
Pandoc Cleanup Details Pandoc Quirk Before After Escaped brackets \[text\][text]Trailing backslashes line\lineSpan classes {.underline}(removed) Image attributes {width="5in"}(removed) Heading anchors {#section-1}(removed) Excessive blank lines \n\n\n\n\n\n
Image Extraction Embedded images are extracted to a sibling images/ folder:
input/
โโโ document.docx
โโโ document.md (output)
โโโ images/
โโโ image1.png
โโโ image2.png
โโโ image3.jpg
Image references in markdown are updated automatically:
Common Workflows
Stakeholder Document Ingestion
node .github/muscles/docx-to-md.cjs stakeholder-spec.docx \
--add-frontmatter --fix-headings --strip-comments
node .github/muscles/markdown-lint.cjs stakeholder-spec.md
git add stakeholder-spec.md images/
git commit -m "docs: ingest stakeholder specification"
Legacy Documentation Migration
Get-ChildItem *.docx | ForEach-Object {
node .github/muscles/docx-to-md.cjs $_ .FullName --add-frontmatter --fix-headings
}
Troubleshooting Problem Cause Solution "pandoc not found" pandoc not installed winget install pandocImages missing Extraction failed Check images/ folder, re-run Tables misaligned Complex table structure Manual cleanup may be needed Headings start at H3 Original doc structure Use --fix-headings Comments in output Track changes not stripped Use --strip-comments Encoding issues Non-UTF8 content Re-save .docx as UTF-8
Limitations
Track changes : Accept or reject all changes in Word before converting
Embedded objects : Charts, SmartArt, etc. must be extracted manually
Complex tables : Merged cells may not convert cleanly
Styles : Word styles are lost (only structural elements preserved)
Headers/footers : Not extracted (document body only)
Requirements
Node.js 18+
pandoc (winget install pandoc)
Muscle Script .github/muscles/docx-to-md.cjs (v1.0.0)
Related Skills
md-to-word โ Reverse direction (Markdown to Word)
lint-clean-markdown โ Post-validate converted Markdown
md-scaffold โ Template for structuring imported content
md-to-html โ Convert result to HTML for web
md-to-eml โ Convert result to email
Skill version: 2.0.0 | Last updated: 2026-04-14 | Category: document-conversion