Inicio / Skills / Ofimática y documentos / Markdown to Word (.docx)
Ofimática y documentos

Markdown to Word (.docx)

awesome-copilot communityMITIdioma del Skill: Inglés
Licencia verificadaIncluye scriptsRiesgo medio
DemostraciónEjecución real · claude-sonnet-5-5 · octubre de 2026
Please turn the Markdown report at .claude/skills/md-to-docx/sample/report.md into a Word document, saved as .claude/skills/md-to-docx/sample/report.docx. Dependencies are not installed yet: install them with `npm install --prefix .claude/skills/md-to-docx/scripts` first (that exact command is allowed), then convert using relative paths. Afterwards tell me what the document contains (title page, table of contents, sections, table, image) and anything that did not convert. To check the result you may run `unzip -p .claude/skills/md-to-docx/sample/report.docx word/document.xml` (that exact command is allowed), and base your description on what is actually in the file.
Skill: md-to-docx

I converted the report and saved it as .claude/skills/md-to-docx/sample/report.docx (11 KB). The dependencies installed with only an engine warning: nanoid wants Node 22 or later and this machine has v20.19.0. The conversion ran fine anyway. The description below comes from the document XML, not just the script's success message.

What the document contains

  • Title page: "Q3 Platform Review" as the title, "Summary for Engineering" as the subtitle, then "Date: 2026-10-01 | Version: 1.2" and "Audience: Engineering, Product". It is followed by a page break.
  • Table of contents: It lists Highlights, Key numbers (indented as a sub-entry) and Plan, then a page break.
  • Sections:
    • Highlights (heading 2) has a paragraph with bold "18%", italic "0.2%", status.md in Consolas with a grey background, and "the dashboard" in blue underline.
    • Key numbers (heading 3) holds the table.
    • Plan (heading 2) has the numbered list "1. Migrate the queue" and "2. Add retries", with "exponential backoff" and "jitter" as indented bullets.
    • A Python code block follows, in Consolas on a grey background.
    • The document ends with the Chinese paragraph (中文段落:延迟下降 18%。), a horizontal rule and "Done."
  • Table: It has 3 columns (Metric, Q2, Q3) and 2 data rows, p95 latency (420 → 344) and Error rate (0.3% → 0.19%). The header row is shaded and repeats across pages, and the rows alternate in colour.
  • Image: diagrams/arch.png is embedded, centred, with the caption "Architecture".

What did not convert cleanly

  • Missing image: diagrams/nope.png was not found, so the document has the placeholder text [Image not found: diagrams/nope.png].
  • Mermaid diagram: It was not rendered. The document has the placeholder "[Diagram: See source .md file for interactive Mermaid diagram]".
  • Tiny image: The embedded architecture image is only about 0.4 × 0.2 inches (381000 × 190500 EMU). The source PNG is probably a tiny placeholder, so it will look very small in Word.
  • Dropped H1: The # Q3 Platform Review — Summary for Engineering heading does not appear in the body or the table of contents. Its text is only on the title page.
  • Link has no URL: "the dashboard" is styled as a link, but there is no hyperlink element in the file, so the https://example.com/dash URL is lost.
  • Static table of contents: It is plain text with no page numbers and no links, so it won't update in Word.
  • Fake lists: The list markers ("1.", "•") are typed characters with indentation, not real Word lists.
  • Code language dropped: The code block keeps its text but not the python language tag, and there is no syntax highlighting.
  • Chinese font: The Chinese text is set in Calibri, which has no CJK glyphs, so Word will substitute a fallback font. I didn't check how it looks.

How it was tried: the Skill needs npm dependencies, so I had the model run the documented npm install first, then convert a sample Markdown file I built (cover metadata, tables, nested lists, code blocks, a PNG image, one deliberately missing image, a Mermaid code block and a Chinese paragraph). Bash was allowed only for npm install, the conversion command and inspecting the docx internal XML. I also unzipped the docx by hand to check, and the model's description matched. The sample PNG is only a 40x20-pixel placeholder, which is why the text says it is tiny in the document.

Qué hace

Ejecuta un script de Node.js incluido que convierte un archivo .md en un .docx usando los paquetes npm docx y marked, sin necesidad de Pandoc ni LibreOffice. Lee el front matter YAML (título, fecha, versión, audiencia) para una portada, crea un índice de H1 a H3, aplica estilo a encabezados, a tablas con colores de fila alternos y a bloques de código, gestiona listas, enlaces y separadores, e incrusta imágenes PNG referenciadas en el Markdown (rutas relativas al archivo, escaladas a unas 6 pulgadas de ancho). Los bloques Mermaid se convierten en una línea de marcador de posición.

Cómo funciona

  1. Haz una instalación única con npm install en la carpeta scripts.
  2. node md-to-docx.mjs input.md [output.docx]; si no se indica un nombre de salida, escribe junto al archivo de entrada, en el directorio actual.

Ideal para

Convertir documentación, especificaciones e informes escritos en Markdown en archivos Word para compartir.

Notas y riesgos

Riesgo medio: ejecuta un script de Node y necesita `npm install` (descarga `docx` y `marked`). Escribe el `.docx` en la ruta de salida y reemplaza un archivo con el mismo nombre sin preguntar, así que usa un nombre nuevo o conserva una copia de seguridad. Las rutas de imagen en el Markdown se resuelven en relación con el archivo de entrada, sin restricción a esa carpeta y sin comprobar que el archivo sea PNG, por lo que convertir un archivo Markdown de una fuente no confiable puede incorporar al documento otros archivos del disco. El script no realiza solicitudes de red. La prueba de ejecución produjo una salida correcta. Limitaciones: los enlaces conservan su texto pero pierden la URL, el índice es texto estático sin números de página ni enlaces de salto, las listas se representan con caracteres escritos y solo se incrusta PNG (otros formatos de imagen se escriben como PNG y pueden no mostrarse).

SKILL.md original4 archivos en este paquete