Index of every page on this site: llms.txt
All skills
github avatar

/md-to-docx

@f10fdb8 official
by githubgithub/awesome-copilot42k stars
5,426
Run it yourself

Convert Markdown files to professionally formatted Word (.docx) documents with embedded PNG images — pure JavaScript, no external tools required

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/md-to-docx

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈40 tokens for metadata: the name and description. ≈646 when used: this file. ≈47 more on demand in 1 file.

Description uses 2.0% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈157 characters, or 2.0%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Markdown to Word (.docx) Skill

Convert Markdown (.md) files into professionally formatted Word (.docx) documents with embedded PNG images. Uses pure JavaScript via the docx and marked npm packages — no Pandoc, LibreOffice, or any native binary required.

How to Convert

# Install dependencies (one-time, from the scripts folder)
cd skills/md-to-docx/scripts && npm install

# Convert (run from workspace root)
node skills/md-to-docx/scripts/md-to-docx.mjs <input.md> [output.docx]

If output.docx is omitted, it defaults to <input-basename>.docx in the current directory.

Skill Folder Contents

File Purpose
SKILL.md This instruction file
scripts/md-to-docx.mjs Node.js Markdown-to-Word converter
scripts/package.json Dependencies (docx, marked)

Prerequisites

Requirement Version Notes
Node.js 18+ Required runtime
docx 9+ Pure JS Word document generator
marked 15+ Markdown parser

No native binaries. No system-level installs. Works on Windows, macOS, and Linux.

Features

The converter:

  • Extracts YAML front-matter — uses title, date, version, audience for the title page
  • Generates a title page — with project name, subtitle, date, version, and audience
  • Generates a table of contents — built from H1-H3 headings
  • Embeds PNG images — resolves ![alt](path) references relative to the input .md file, reads the PNG, and embeds it inline in the Word document
  • Styled output — Calibri font, colored headings (#1F3864), styled tables with alternating row colors, code blocks in Consolas
  • Handles all Markdown elements — headings, paragraphs, tables, code blocks, lists, images, links, horizontal rules

Image Embedding

The converter automatically embeds PNG images referenced in the Markdown:

![High-Level Architecture](diagrams/high-level-architecture.drawio.png)

The image path is resolved relative to the input Markdown file. The PNG is read, dimensions are extracted from the PNG header, and the image is scaled to fit within 6 inches width while preserving aspect ratio.

If an image file is not found, a placeholder [Image not found: <path>] is inserted.

Front-Matter Format

---
title: Project Name — Project Summary
date: 2025-01-15
version: 1.0
audience: Engineering Team, Architects, Stakeholders
---

The title is split on — or – into main title and subtitle for the title page.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill is safe. It provides a local JavaScript utility to convert Markdown files to Word (.docx) documents using standard npm libraries, with no external network access, command execution, or other security concerns.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at f10fdb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 7 months ago
  • markdown
  • docx
  • word
  • document-generation
  • javascript
  • node.js
  • image-embedding
  • yaml

README badge

README badge for github/awesome-copilot/md-to-docx

Converts Markdown files to formatted Word documents (.docx) with embedded PNG images using pure JavaScript — no external binaries required. Uses the `docx` and `marked` npm packages to generate a title page, table of contents, styled headings and tables, and inline images resolved relative to the input file.

Generated from the current SKILL.md.

Does this require Pandoc or LibreOffice?
No. The skill uses pure JavaScript (docx and marked npm packages) and runs on Node.js 18+. No native binaries or system-level tools required.
What image formats are supported?
PNG only. The skill embeds PNG images by reading the file and extracting dimensions from the PNG header. Other formats are not supported.
How are image paths resolved?
Image paths in Markdown are resolved relative to the input .md file's directory. If a file is not found, a placeholder text is inserted in the document.
Does this generate a table of contents?
Yes. The converter automatically generates a table of contents from H1-H3 headings in the Markdown.
What YAML fields are used from front-matter?
The skill uses title (split on — or – for title and subtitle), date, version, and audience to populate the generated title page.

Generated from the current SKILL.md. These answers refresh after source changes.