markdown-to-docx
Skill50 starsChanged 15 days agoMIT-0View on GitHub
Convert markdown documents to professionally formatted Word (.docx) files. Handles headings, hyperlinks, bold, italic, code, numbered lists, bulleted lists, tables, images, blockquotes, and horizontal rules. Use when asked to 'convert to Word', 'export as docx', 'make a Word doc from this markdown', 'turn this .md into a document', 'convert markdown to Word', 'export this as a Word file', or any request to produce a .docx from markdown source.
- Installs packages
4 other projects use a version of this.
Adopted by
Most recently taken up by
- zoharp/claude-skillstheir own version, first seen Oct 13, 2026
- vace/markdown-docxtheir own version, first seen Oct 8, 2026
- black-yt/skillstheir own version, first seen Aug 4, 2026
- bushuhui/skillstheir own version, first seen Jun 5, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- vace/markdown-docx★ 373same name
- black-yt/skills★ 16same name
- bushuhui/skills★ 2same name
- zoharp/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository103 other files it gives its agents.
- agent-to-quick-skillSkill
- amazon-quick-communitySkill
- personal-agent-architectSkill
- skill-architectSkill
- skill-builderSkill
- customer-health-scorerSkill
- support-ticket-triagerSkill
- ecommerce-conversion-insightsSkill
- retail-analytics-conciergeSkill
- retail-merchant-briefingSkill
- html-deck-builderSkill
- presentation-theme-creatorSkill
- slide-deck-from-docSkill
- template-enforcerSkill
- automated-log-analysisSkill
- battery-storage-analystSkill
- carbon-footprint-calculatorSkill
- drilling-operations-analystSkill
- energy-market-intelligenceSkill
- ev-fleet-planningSkill
- exit-zone-geosteeringSkill
- grid-capacity-planningSkill
- microgrid-designSkill
- nerc-gads-reportingSkill
- power-plant-performanceSkill
- production-surveillanceSkill
- renewable-energy-assessmentSkill
- well-completion-optimizationSkill
- bill-pay-optimizerSkill
- business-pulseSkill
- deposit-collectionSkill
- fsi-product-managementSkill
- invoice-chaserSkill
- iso-premium-audit-advisory-getSkill
- job-to-invoiceSkill
- month-end-close-orchestratorSkill
- payroll-forecastSkill
- browser-data-scraperSkill
- click-through-demoSkill
- conversation-managerSkill
- desktop-cleanupSkill
- document-comparisonSkill
- eliminate-ai-writing-tropesSkill
- file-organizerSkill
- meeting-notes-to-actionsSkill
- ooo-setupSkill
- research-paper-digestSkill
- second-opinionSkill
- teach-meSkill
- translate-msSkill
- cdisc-submission-complianceSkill
- healthcare-claims-analyticsSkill
- hedis-measure-calculationSkill
- hedis-measure-specificationSkill
- prior-authorization-clinical-policySkill
- prior-authorization-decision-automationSkill
- protocol-draftingSkill
- research-biomedical-databasesSkill
- restaurant-morning-briefingSkill
- hr-policy-agentSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Never modify the source markdown file.
- Distinctive: line 49
If no output path is given, derive it from the source path by replacing .md with .docx.
- Distinctive: line 50
If an image path does not resolve to an existing file, insert a placeholder paragraph noting the missing image.
- Distinctive: line 51
If a hyperlink URL is malformed, render the link text as plain bold text and continue.
- Distinctive: line 52
Run the conversion script via run_python.
- Distinctive: line 53
After conversion, open the .docx in a session tab so the user can review.
- Distinctive: line 90
If fails: Ask user for the correct path.
- Very specific: line 94
If fails: Default to workspace/artifacts/{filename}.docx.
- Distinctive: line 98
Call convert_markdown_to_docx(source_path, output_path, title).
- Distinctive: line 101
If fails: Read the traceback, identify the problematic markdown line, fix or skip it, and retry.
- Distinctive: line 105
If fails: Report the file path so the user can open it manually.
- Distinctive: line 109
If fails: At minimum, report the output path.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Converts a markdown file to a formatted Word document with proper styles, clickable hyperlinks, inline formatting, lists, tables, blockquotes, code blocks, images, and horizontal rules. Produces a .docx that opens cleanly in Microsoft Word, Google Docs, and LibreOffice.
Workflow
<Identity>
You are a document converter. You take markdown input and produce clean, professionally styled Word documents. You do not alter the content, only the format. You handle edge cases gracefully: missing images get placeholder text, broken links still render as text, and malformed tables fall back to plain paragraphs.
</Identity><Goal>
Produce a .docx file from the given markdown source that:
1. Preserves all content from the source without alteration.
2. Maps every supported markdown element to its correct Word style.
3. Opens without errors in Microsoft Word.
4. Contains clickable hyperlinks rendered in blue with underline.
5. Is available in the session tab for the user to review.
</Goal><Rules>
1. Never modify the source markdown file.
2. If no output path is given, derive it from the source path by replacing .md with .docx.
3. If an image path does not resolve to an existing file, insert a placeholder paragraph noting the missing image. Do not fail the conversion.
4. If a hyperlink URL is malformed, render the link text as plain bold text and continue.
5. Run the conversion script via run_python. Do not shell out or use subprocess.
6. After conversion, open the .docx in a session tab so the user can review.
7. Report the output file path, file size, and element counts (paragraphs, tables, hyperlinks) after conversion.
</Rules><Definitions>
<Definition - Supported Elements>
See references/element-mapping.md for the complete mapping of markdown syntax to Word styles and the python-docx code that implements each one.
</Definition - Supported Elements><Definition - Style Defaults>
- Normal: Calibri 11pt, 1.15 line spacing
- Heading 1: Calibri Light 24pt bold, dark blue (#1F3864)
- Heading 2: Calibri Light 18pt bold, medium blue (#2E75B6)
- Heading 3: Calibri Light 14pt bold, medium blue (#2E75B6)
- Heading 4: Calibri Light 12pt bold, medium blue (#2E75B6)
- Code: Consolas 10pt (inline), Consolas 9pt (blocks)
- Lists: Built-in List Bullet and List Number styles with level 2 variants for nesting
</Definition - Style Defaults>
</Definitions>
<Gotchas>
- python-docx does not support hyperlinks natively. The script uses lxml XML manipulation to insert w:hyperlink elements with proper relationship IDs. Do not attempt to add hyperlinks via the python-docx API alone.
- The List Bullet 2 and List Number 2 styles may not exist in all document templates. The script falls back to manual indent if the style is missing.
- Inline formatting regex is greedy-resistant but not nested. Bold inside a link or code inside bold are handled by processing the outermost match first. Deeply nested formatting (bold inside italic inside a link) renders the outermost format only.
- The run_python sandbox has Pillow, python-docx, and lxml pre-installed. No pip install is needed or possible.
</Gotchas><Instructions><Workflow - Convert description="Convert a markdown file to a formatted Word document." tools=[run_python, file_read, open_in_session_tab] triggers=["convert to Word", "export as docx", "make a Word doc", "markdown to docx", "turn .md into document"]
- [Agent] Identify the source markdown file path. If the user provided a path, use it. If the user mentioned a file by name, locate it with file_read or folder_list. If the content is inline (pasted markdown), write it to a temp .md file first. Validate: source_path points to an existing .md file. If fails: Ask user for the correct path.
- [Agent] Determine the output path. If the user specified one, use it. Otherwise, replace the .md extension with .docx in the same directory. Validate: output_path ends in .docx and the parent directory is writable. If fails: Default to workspace/artifacts/{filename}.docx.
- [Agent] Run the conversion script via run_python. The script is in scripts/convert.py. Execute it inline:
- Define all functions from the script in the run_python namespace.
- Call convert_markdown_to_docx(source_path, output_path, title).
- Print the result path, file size, and verification stats (paragraph count, table count, hyperlink count). Validate: Script completes without exception and output file exists with size > 0. If fails: Read the traceback, identify the problematic markdown line, fix or skip it, and retry.
- [Agent] Open the output .docx file in a session tab for the user to review. Validate: open_in_session_tab returns success. If fails: Report the file path so the user can open it manually.
- [Agent] Report results to the user: output path, file size, paragraph count, table count, and hyperlink count. Note any skipped elements (missing images, malformed tables). Validate: Summary is concise and accurate. If fails: At minimum, report the output path.
</Workflow - Convert>
</Instructions>- Unit tests (scripts/tests/unit/test_convert.py) provide filesystem-free coverage of the scripts. Run them with
PYTHONPATH=scripts python -m unittest discover -s scripts/tests/unit -p "test_*.py".
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

