Markdown to Word Converter

Markdown to Word Converter

Converts Markdown files into formatted Word documents with title page, table of contents and embedded PNG images, using pure JavaScript with no external tools.

Skill files3 files

scripts/

SKILL.md75 lines
1
---
2
name: md-to-docx
3
description: Convert Markdown files to professionally formatted Word (.docx) documents with embedded PNG images — pure JavaScript, no external tools required
4
---
5
6
# Markdown to Word (.docx) Skill
7
8
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.
9
10
## How to Convert
11
12
```bash
13
# Install dependencies (one-time, from the scripts folder)
14
cd skills/md-to-docx/scripts && npm install
15
16
# Convert (run from workspace root)
17
node skills/md-to-docx/scripts/md-to-docx.mjs <input.md> [output.docx]
18
```
19
20
If `output.docx` is omitted, it defaults to `<input-basename>.docx` in the current directory.
21
22
## Skill Folder Contents
23
24
| File | Purpose |
25
|------|---------|
26
| `SKILL.md` | This instruction file |
27
| `scripts/md-to-docx.mjs` | Node.js Markdown-to-Word converter |
28
| `scripts/package.json` | Dependencies (`docx`, `marked`) |
29
30
## Prerequisites
31
32
| Requirement | Version | Notes |
33
|-------------|---------|-------|
34
| **Node.js** | 18+ | Required runtime |
35
| **`docx`** | 9+ | Pure JS Word document generator |
36
| **`marked`** | 15+ | Markdown parser |
37
38
No native binaries. No system-level installs. Works on Windows, macOS, and Linux.
39
40
## Features
41
42
The converter:
43
44
- **Extracts YAML front-matter** — uses `title`, `date`, `version`, `audience` for the title page
45
- **Generates a title page** — with project name, subtitle, date, version, and audience
46
- **Generates a table of contents** — built from H1-H3 headings
47
- **Embeds PNG images** — resolves `![alt](path)` references relative to the input `.md` file, reads the PNG, and embeds it inline in the Word document
48
- **Styled output** — Calibri font, colored headings (`#1F3864`), styled tables with alternating row colors, code blocks in Consolas
49
- **Handles all Markdown elements** — headings, paragraphs, tables, code blocks, lists, images, links, horizontal rules
50
51
## Image Embedding
52
53
The converter automatically embeds PNG images referenced in the Markdown:
54
55
```markdown
56
![High-Level Architecture](diagrams/high-level-architecture.drawio.png)
57
```
58
59
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.
60
61
If an image file is not found, a placeholder `[Image not found: <path>]` is inserted.
62
63
## Front-Matter Format
64
65
```yaml
66
---
67
title: Project Name — Project Summary
68
date: 2025-01-15
69
version: 1.0
70
audience: Engineering Team, Architects, Stakeholders
71
---
72
```
73
74
The title is split on `—` or `–` into main title and subtitle for the title page.
75

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,419 prompts

More by @OpenSourceBuffGuy

See all
Blue and gold character tree with doll ornaments prompt image

Blue and gold character tree with doll ornaments

Turns a reference character into a lavishly decorated Christmas tree with themed plush ornaments, matching lights and a character topper.

image-prompt, reference-image, photo-editing, christmas, holiday, photorealistic, nano-banana, placeholders, structured-output, character-design, cozy, luxury, still-life, golden-hour, soft-lighting, vibrant-colors, wide-shot, for-artists, gift-ideas, vertical-format

Woman laughs as giant koi splash her prompt image

Woman laughs as giant koi splash her

Generates a 15-second handheld phone-style video of a woman laughing as giant koi splash her in a Japanese canal town, keeping her face from a reference image.

video-prompt, hailuo, timed-beats, handheld, vlog, documentary, smartphone-photo, candid, reference-image, character-consistency, photorealistic, natural-light, summer, japan, animals, travel, negative-prompt, vertical-format, structured-output, long-form, for-content-creators, for-filmmakers, camera-movement, ugc-video, sound-effects, minimax

Young women walk a lively Korean night market prompt image

Young women walk a lively Korean night market

Generates a realistic documentary-style video of a young Korean woman walking a night market, choosing grilled food and eating it, with ambient audio and a strict negative list.

video-prompt, seedance, vlog, documentary, handheld, lip-sync, negative-prompt, cinematic, photorealistic, night-scene, widescreen, camera-movement, korea, travel, cooking, restaurants, structured-output, long-form, for-content-creators, for-filmmakers, cityscape, single-take, scene-transitions, warm-lighting

Reviews

Loading reviews…

Discussion

Loading comments…