---
name: markdown-pdf-docker
description: Render markdown files to real PDF output using a Dockerized toolchain with pandoc, wkhtmltopdf, chromium, and mermaid-cli. Use when a user wants a styled PDF from markdown, especially when the markdown may include Mermaid diagrams or charts.
---

# Markdown PDF Docker

Use this skill when a markdown file needs to become a real PDF and the local machine should not rely on host-installed PDF tooling.

This skill provides a Docker-based renderer with:

- `pandoc` for markdown to HTML
- `wkhtmltopdf` for HTML to PDF
- `chromium` and `mermaid-cli` for Mermaid diagram rendering

## Workflow

1. Build the Docker image if it is missing or the Dockerfile changed:
   `./.codex/skills/markdown-pdf-docker/scripts/build_image.sh`
2. Render the markdown file:
   `./.codex/skills/markdown-pdf-docker/scripts/render_pdf.sh <input.md> <output.pdf>`

## Notes

- Input and output paths may be relative or absolute.
- The renderer preprocesses Mermaid fenced code blocks into SVG files before PDF generation.
- The output is intended for reports and documentation, not pixel-perfect print design.
- Docker daemon access is required. If Docker socket access is blocked by the sandbox, request escalation and proceed.

## Files

- Host wrapper: `scripts/build_image.sh`
- Host wrapper: `scripts/render_pdf.sh`
- Container build: `assets/Dockerfile`
- Container renderer: `assets/render_markdown_pdf.sh`

