A markdown toolbox
Project description
marksmith
A Markdown toolbox — write docs in Markdown, ship them as polished DOCX.
Installation
pip install marksmith
Optional extras for template support:
pip install marksmith[template]
Quick start
# Using the installed script
marksmith convert my-doc.md output.docx
# Or via python -m
python -m marksmith convert my-doc.md output.docx
Markdown front-matter
You can add a YAML front-matter block at the top of your Markdown file.
The metadata is written to the DOCX core properties (title, author, etc.)
and is also available as Jinja2 template variables when using --template.
---
title: My Document
version: 1.0
author: Paul Cummings
date: 2026-03-16
classification: Internal
---
# My Document
Content goes here...
Supported Markdown elements
| Element | Status |
|---|---|
| Headings H1 – H6 | ✅ |
| Bold / italic / inline code | ✅ |
| Fenced and indented code blocks | ✅ |
| Unordered lists (nested) | ✅ |
| Ordered lists (nested) | ✅ |
| Block-quotes | ✅ |
| Tables | ✅ |
| Thematic breaks (horizontal rules) | ✅ |
| Strikethrough | ✅ |
| Links (text rendered, no hyperlink) | ⚠️ |
| Images | ⚠️ placeholder text only |
| Inline HTML | ➖ ignored |
Template support
Keep your content in plain Markdown while producing brand-consistent DOCX output from a corporate template.
pip install marksmith[template]
marksmith convert my-doc.md output.docx --template company-template.docx
How it works
-
Create a
.docxtemplate in Word with Jinja2-style placeholders for metadata sourced from your Markdown front-matter:{{ title }} {{ version }} {{ author }} {{ date }} {{ classification }}
-
Add a
{{p marksmith_content }}paragraph alone on its own line at the exact point where the Markdown body should be inserted:{{p marksmith_content }}Important: Use
{{p ... }}(with thepmodifier), not{{ ... }}. Thepmodifier inserts a paragraph-level sub-document rather than plain text, so all headings, lists, tables, and code blocks are preserved. -
Run the conversion — marksmith will:
- Render all front-matter metadata into the Jinja2 placeholders.
- Convert the Markdown body to native DOCX content.
- Insert the body at
{{p marksmith_content }}. - Save the merged document.
Style inheritance
Content is inserted as a sub-document, so heading and paragraph styles are
matched by name against those in your template. If your template defines
Heading 1 with a custom font and colour, the converted content will pick
it up automatically.
Roadmap
| Action | Description |
|---|---|
convert |
Markdown → DOCX ✔️ |
convert --template |
Merge into branded DOCX template ✔️ |
lint |
Validate Markdown style and structure |
toc |
Generate / update table of contents |
diff |
Show structural diff between two Markdown files |
| Images | Embed local images via run.add_picture() |
| Hyperlinks | Full OOXML hyperlink support |
Development
git clone https://github.com/tkdpython/marksmith
cd marksmith
pip install -e .[dev,template]
# Run tests
pytest
# Lint
ruff check .
Releasing
- Bump
__version__inmarksmith/__init__.py. - Commit and push.
- Create a GitHub Release with a tag matching the version (e.g.
v0.2.0). - The publish workflow fires automatically and publishes to PyPI via OIDC Trusted Publisher — no API tokens needed.
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marksmith-0.2.0.tar.gz.
File metadata
- Download URL: marksmith-0.2.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d59452385d17da158f6f2a9fc2eeb6cb7ae2b8451fba1ad5e1c9ad839945608
|
|
| MD5 |
8cc98d63c369780671b84bc30df0e071
|
|
| BLAKE2b-256 |
dcf0e5a4c155c47f18cf02eeb749d273ba9d074efbee717b07ca89ff63f1feb7
|
Provenance
The following attestation bundles were made for marksmith-0.2.0.tar.gz:
Publisher:
publish.yml on tkdpython/marksmith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
marksmith-0.2.0.tar.gz -
Subject digest:
7d59452385d17da158f6f2a9fc2eeb6cb7ae2b8451fba1ad5e1c9ad839945608 - Sigstore transparency entry: 1110817314
- Sigstore integration time:
-
Permalink:
tkdpython/marksmith@674c1d3202de892b8febac07516b404e7459c330 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/tkdpython
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@674c1d3202de892b8febac07516b404e7459c330 -
Trigger Event:
release
-
Statement type:
File details
Details for the file marksmith-0.2.0-py3-none-any.whl.
File metadata
- Download URL: marksmith-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9efeeff58726df2e6713f0af1194c6c9129f87ccb827e93d25d9eb1139380b0
|
|
| MD5 |
a63d66157f05823cb2451e92b32ae324
|
|
| BLAKE2b-256 |
f9882ed0504803d85bbb66996ff6fdceef70babbe0e7aecf3c6aed183ccaebae
|
Provenance
The following attestation bundles were made for marksmith-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on tkdpython/marksmith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
marksmith-0.2.0-py3-none-any.whl -
Subject digest:
f9efeeff58726df2e6713f0af1194c6c9129f87ccb827e93d25d9eb1139380b0 - Sigstore transparency entry: 1110817315
- Sigstore integration time:
-
Permalink:
tkdpython/marksmith@674c1d3202de892b8febac07516b404e7459c330 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/tkdpython
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@674c1d3202de892b8febac07516b404e7459c330 -
Trigger Event:
release
-
Statement type: