Command-line tools for rendering and round-tripping HPDF Technical Design Specification documents between Markdown and DOCX.
For details of the workflow and its philosophy, look at TDS_WORKFLOW.md. This is also the file you should let your agent read and follow when working with TDSs.
| Command | What happens |
|---|---|
tds render <file.md> |
Renders a TDS Markdown source to a styled DOCX with cover page, DOE disclaimer, TOC, and Mermaid diagrams |
tds unrender <file.docx> |
Converts a reviewed DOCX back to Markdown, restoring Mermaid blocks and YAML frontmatter |
All conversion logic runs inside a Docker container — pandoc, Mermaid CLI, and python-docx are bundled in the image. The only local dependency is Docker.
Docker Desktop, Colima, or any Docker-compatible runtime. No other local tools required.
Download the tds wrapper script and make it executable:
On macOS/Linux you may need
sudoif/usr/local/binis root-owned:sudo curl -fsSL https://raw.githubusercontent.com/ibaldin/tds/main/tds \ -o /usr/local/bin/tds && sudo chmod +x /usr/local/bin/tdsAlternatively, install to a user-writable location on your
PATH:curl -fsSL https://raw.githubusercontent.com/ibaldin/tds/main/tds \ -o ~/bin/tds && chmod +x ~/bin/tds
Then pull the Docker image (one-time, also to update to latest):
tds pullRun tds from your TDS working directory. The current directory is
volume-mounted into the container, so all relative paths — diagrams/,
.mmd sidecars, referenced PNGs — resolve naturally.
cd ~/path/to/your/tds
# Initialize the repo
tds init
# Create a fresh doc (it will be HPDF_TDS_0002)
tds new --owner "J.Doe" --component iam "Identity and Access Management"
# Render Markdown to DOCX for the existing example
# The document created from `tds new` wbove is likely to be called HPDF_TDS_0002_iam.md
# It will only have the basic sections and no diagram examples, so instead use
# the example document like so:
# validate diagrams saving .mmd files under @diagrams/ as well as newly generated .pngs
tds validate HPDF_TDS_0001_example.md
# render to DocX (will use .pngs that are generated from Mermaid diagrams)
tds render HPDF_TDS_0001_example.md
# Unrender a reviewed DOCX back to Markdown
# By default will substitute Mermaid text blocks instead of diagrams back where they
# belong. Use --nommdc if you don't want it to do that.
tds unrender HPDF_TDS_0001_example.docx
# See all options for either subcommand
tds -h
tds render --help
tds unrender --helpThree diagram formats are supported in TDS source files:
- ASCII art — use a
```textfenced block for simple inline sketches. You can use--ascii-art-font-sizeoption withtds renderto change how the ASCII art diagrams look in DocX. Default is 9 pts font. - Mermaid — use a
```mermaidblock; the render pipeline converts it to PNG automatically and saves a.mmdsidecar for round-trip recovery indiagrams/. By default the workflow substitues Mermaid diagrams with PNG files saved indiagrams/when you calltds renderand attempts to reinsert```mermaidblocks back based on the saved .mmd files indiagrams/when you calltds unrender. You can stop the conversion back to Mermaid by adding--nommdctotds unrendercommand. - Engineer-authored PNG — place in
diagrams/and reference with - draw.io (diagrams.net) XML — one effective way to produce engineer-authored
PNGs is to have the AI assistant generate draw.io
XML for the diagram, then refine it either online at
app.diagrams.net or locally with the
draw.io VSCode extension.
Keep the
.drawioXML indiagrams/so it can be version controlled alongside the TDS source, export a PNG from it, and reference the PNG withper the standard PNG workflow above. This gives you editable, diffable diagram sources in git while still embedding the rendered PNG in the DOCX.
Something like:
$ docker buildx build -t ibaldin/tds:$(cat VERSION.txt) -t ibaldin/tds:latest --platform linux/amd64 -f Dockerfile --push .To pull the latest image:
tds pullTo pull latest TDS_WORKFLOW, example or other resource files do this in the TDS repository - it is safe not to overwrite anything that exists. If you want it to overwrite a specific file, remove it first.
tds initTo pin to a specific version, set the TDS_IMAGE environment variable:
TDS_IMAGE=ibaldin/tds:1.0 tds render HPDF_TDS_0001_example.md