How this skill is triggered — by the user, by Claude, or both
Slash command
/md2pdf:convertThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Convert a Markdown file to a styled PDF with support for syntax-highlighted code blocks, tables, mermaid diagrams, images, and ASCII art.
Convert a Markdown file to a styled PDF with support for syntax-highlighted code blocks, tables, mermaid diagrams, images, and ASCII art.
Input: A path to a Markdown file, and optionally an output PDF path. If no output path is given, the PDF is saved next to the input file with the same name and .pdf extension.
Steps
Resolve the input file
If the user provides a file path, use it. If not provided or ambiguous:
.md files in the current directoryVerify the file exists before proceeding.
Ensure dependencies are installed
The conversion script lives in the md2pdf plugin directory. Check if node_modules exists there:
PLUGIN_DIR="$(dirname "$(dirname "$(dirname "$(readlink -f "$0")")")")"
In practice, find the plugin directory by looking for the md2pdf plugin root (the directory containing package.json and scripts/convert.mjs). A reliable way:
# Find the plugin directory — it's wherever this plugin is installed
MD2PDF_DIR=$(find ~/.claude/plugins -path "*/md2pdf/scripts/convert.mjs" -exec dirname {} \; 2>/dev/null | head -1)
MD2PDF_DIR=$(dirname "$MD2PDF_DIR") # go up from scripts/ to plugin root
If $MD2PDF_DIR/node_modules does not exist, install dependencies:
cd "$MD2PDF_DIR" && npm install
Also ensure Playwright browsers are available:
npx playwright install chromium
Run the conversion
node "$MD2PDF_DIR/scripts/convert.mjs" "<input.md>" "<output.pdf>"
Pass --no-mermaid if the user asks to skip mermaid rendering (faster).
Report the result
Tell the user where the PDF was saved. If the conversion failed, show the error output and suggest fixes:
--no-mermaid flagnpx playwright install chromiumOpen the PDF
On macOS, open the PDF for the user:
open "<output.pdf>"
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub tillg/till-claude-code-marketplace --plugin md2pdf