agentleFS
phanghonghaophanghonghao/THU-Awesome-Skills/skills/md2docx/SKILL.md

md2docx

Skill8 starsChanged 3 months agoMITView on GitHub

Fill an existing Word `.docx` template using data and images from a Markdown file. Use when the user mentions `md2docx`, wants to write Markdown content back into a Word document, populate Word tables, preserve merged cells, or insert images into a `.docx` template.

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    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
  1. Distinctive:

    If the output path is omitted, let the script create the default filled output file.

    line 28
  2. Distinctive:

    Use the script for:

    line 32
  3. Distinctive:

    If image paths are relative, resolve them relative to the Markdown file location first.

    line 44
  4. Distinctive:

    If it is missing, install it with:

    line 50
  5. Distinctive:

    Do not rebuild the document from scratch when the task is to fill an existing template.

    line 58
  6. Distinctive:

    Prefer the script over manual XML edits unless the script itself needs patching.

    line 59
  7. Distinctive:

    If headers in Markdown and Word do not match well enough for filling, explain which columns failed to align.

    line 60
  8. Very specific:

    If the user asks for a change in mapping behavior, inspect and patch md2docx.py rather than hand-editing the .docx.

    line 61

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

md2docx

Fill an existing Word document from a Markdown source with the bundled md2docx.py script.

Run

From this skill directory, run:

python md2docx.py "<input.md>" "<template.docx>" ["<output.docx>"]

Inputs

Require:

  • a Markdown file containing table data and optional image references
  • an existing .docx template to modify

If the output path is omitted, let the script create the default filled output file.

What the Script Handles

Use the script for:

  • matching Markdown table data into Word tables
  • merged cells, including horizontal and vertical merges
  • inserting images referenced from Markdown
  • mixed numeric and text values

Workflow

  1. Confirm the Markdown file exists.
  2. Confirm the template .docx exists.
  3. Run md2docx.py.
  4. Report the output document path.
  5. If image paths are relative, resolve them relative to the Markdown file location first.

Dependencies

Require python-docx.

If it is missing, install it with:

python -m pip install python-docx

Operating Notes

  • Do not rebuild the document from scratch when the task is to fill an existing template.
  • Prefer the script over manual XML edits unless the script itself needs patching.
  • If headers in Markdown and Word do not match well enough for filling, explain which columns failed to align.
  • If the user asks for a change in mapping behavior, inspect and patch md2docx.py rather than hand-editing the .docx.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.