@druckform/core
v0.4.0
Published
Markdown → PDF via LaTeX — engine CLI
Readme
@druckform/core
Druckform turns Markdown into styled, print-ready PDFs by way of LaTeX. It exists for one situation in particular: a document gets written by an AI agent (usually Claude) and needs to come out looking properly typeset, not like a plain Markdown export.
The name is German. A Druckform is the printing forme, the locked-up block of type and images that a letterpress actually prints from, the last thing you assemble before you pull a proof. That is roughly the job here: you hand it a style (colors, fonts, spacing) and a template (a set of components), and it composes your Markdown into LaTeX and presses that through Tectonic into a PDF.
@druckform/core is that engine and its command-line tool, the druck binary (also aliased as druckform).
Markdown ──▶ parse ──▶ compose (style + template) ──▶ LaTeX ──▶ Tectonic ──▶ PDFInstall
npm install -g @druckform/coreRequires Node.js ≥ 22. Rendering shells out to Tectonic (LaTeX) and, for diagrams, to Graphviz, a JRE (PlantUML), Chromium (Mermaid), and librsvg. You don't have to install those yourself: druck can relay the render into the prebuilt Docker image automatically (see Execution engines). For a zero-install workflow, use the image directly:
docker run --rm -v "$(pwd):/work" ghcr.io/druckform/druckform:latest \
render --template base --style /work/style.yaml --in /work/document.md --out /work/out.pdfRender a document
# 1. Discover what's available
druck templates # list templates
druck components --template base # components + their syntax/params
# 2. Validate before rendering (cheap — catches unknown components, missing params/tokens)
druck lint --template report --style style.yaml --in document.md
# 3. Render to PDF
druck render --template report --style style.yaml --in document.md --out out.pdfA document is Markdown with optional YAML frontmatter and ::: component directives. --template is optional when the document's frontmatter declares template:; --style is optional when the template carries its own. See the Authoring guide for the full format and component reference.
Rendering with an AI agent
Druckform is designed to be driven by a coding agent (e.g. Claude Code). The whole surface is discoverable and every command emits a stable JSON contract.
Recommended: the Claude Code plugin. It adds a skill that drives the druck CLI, which renders through Docker automatically, so the agent needs no local LaTeX toolchain:
/plugin marketplace add druckform/druckform
/plugin install druckform@druckformThe agent then follows a tight loop: discover (druck templates, druck components -t <t> --json) → write the Markdown → validate (druck lint --json) → render (druck render). Because lint and render exit non-zero and report findings as JSON, the agent can fix issues and retry deterministically.
Or drive the CLI directly. Point the agent at the druck binary and pass --json to any command for machine-readable output:
druck components --template base --json # component contracts to author against
druck lint --template report --in doc.md --style style.yaml --json
druck render --template report --in doc.md --style style.yaml --out out.pdf --jsonExecution engines
druck render and druck preview-component choose where the render actually runs:
--engine local: use the tools installed on this machine.--engine docker: relay the command into a container (defaultghcr.io/druckform/druckform:<version>, override withDRUCK_DOCKER_IMAGE).--engine auto(default): probe for the local tools; run locally if all are present, otherwise relay to Docker. SetDRUCK_ENGINE=local|docker|autoto change the default without a flag.
Paths are mounted identically inside the container, so --in/--out/--style/--assets need no rewriting. All other commands (templates, components, lint, doctor, new) always run locally.
Documentation
- Authoring guide: document format, components, styles, templates
- Extending guide: the full developer surface: CLI, MCP, authoring and overriding components/templates/styles
- Examples gallery
Related packages
- @druckform/mcp: a Model Context Protocol server that exposes this engine to MCP-capable agents (experimental; the Claude Code plugin uses the skill and CLI, not this server).
MIT © druckform · github.com/druckform/druckform
