CLI & Command Usage¶
Jekyll Pandoc Exports provides two ways to run exports from the command line:
jekyll export— A Jekyll command that runs within your site's context (reads_config.yml, knows your collections). This is the recommended approach for Jekyll sites.jekyll-pandoc-exports— A standalone CLI tool for converting individual HTML files outside of Jekyll.
Jekyll Export Command¶
Added in v0.2.0
The jekyll export command generates PDF and DOCX files from your built site without triggering a full jekyll build. It reads your _config.yml for pandoc_exports settings and processes pages that have pdf: true or docx: true in their front matter.
Prerequisites¶
The site must be built first (_site/ must exist):
Basic Usage¶
# Export all configured pages (both PDF and DOCX)
bundle exec jekyll export
# Export PDF only
bundle exec jekyll export --format pdf
# Export DOCX only
bundle exec jekyll export --format docx
Targeting Specific Pages¶
# Export only the print page
bundle exec jekyll export --target print
# Export only the about page
bundle exec jekyll export --target about
Dry Run Mode¶
Print the exact Pandoc command that would be executed without actually running it. Invaluable for debugging LaTeX template issues:
Output shows:
- The Pandoc command with all flags
- Input size (bytes of processed HTML)
- Output file path
- Whether Unicode cleanup is enabled
- How many
title_cleanuppatterns are applied
Schema Validation¶
Validate your _data/data.yml structure before attempting export. Catches missing fields and malformed data early:
Validation checks:
- Required top-level sections exist (
sidebar,career-profile,education,experiences) - Required sidebar fields are present (
name,tagline,email) - Experience entries have
role,company, andtime - Education entries have
degreeanduniversity - YAML syntax is valid
Combine with export:
Custom Output Directory¶
# Override the configured output directory
bundle exec jekyll export --output ~/Downloads
# Export to a specific path
bundle exec jekyll export --output ./dist/exports
All Options¶
| Option | Description | Default |
|---|---|---|
--format FORMAT |
Output format: pdf, docx, both |
both |
--target TARGET |
Export specific page by filename | All configured pages |
--dry-run |
Print Pandoc command without executing | false |
--validate |
Validate _data/data.yml schema first |
false |
--output DIR |
Override output directory | From _config.yml |
--source DIR |
Source directory | . |
--config FILE |
Configuration file | _config.yml |
How It Works¶
- Reads
_config.ymlforpandoc_exportssettings - Scans source directory for
.htmlfiles withpdf: trueordocx: truefront matter - Locates the corresponding built HTML in
_site/ - Applies
title_cleanuppatterns andimage_path_fixesfrom config - Applies template CSS injection
- Runs Pandoc conversion (PDF via LaTeX, DOCX directly)
- Writes output to the configured directory
Workflow Examples¶
Fast iteration on PDF styling¶
# Build once
bundle exec jekyll build
# Iterate on export without rebuilding
bundle exec jekyll export --format pdf --target print
# Check what Pandoc sees
bundle exec jekyll export --dry-run --target print
CI/CD integration¶
# GitHub Actions
- name: Build site
run: bundle exec jekyll build
- name: Validate and export
run: bundle exec jekyll export --validate
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: resume-exports
path: _site/downloads/
Pre-commit validation¶
Standalone CLI Tool¶
The standalone CLI converts individual HTML files without requiring a Jekyll site context. Useful for one-off conversions or integration with external build systems.
Installation¶
Or with Bundler:
Convert Single File¶
# Convert HTML file to both DOCX and PDF
jekyll-pandoc-exports --file page.html
# Convert to PDF only
jekyll-pandoc-exports --file page.html --format pdf
# Convert to DOCX only
jekyll-pandoc-exports --file page.html --format docx
Custom Output Directory¶
# Specify output directory
jekyll-pandoc-exports --file page.html --output /tmp/exports
# Output to current directory
jekyll-pandoc-exports --file page.html --output .
Process Entire Jekyll Site¶
Standalone CLI Options¶
| Option | Short | Description | Default |
|---|---|---|---|
--file FILE |
-f |
Convert single HTML file | - |
--format FORMAT |
- | Output format: docx, pdf, both |
both |
--output DIR |
-o |
Custom output directory | Same as input file |
--source DIR |
-s |
Jekyll source directory | . |
--destination DIR |
-d |
Jekyll destination directory | _site |
--debug |
- | Enable verbose debug output | false |
--help |
-h |
Show help message | - |
Batch Processing¶
# Convert all HTML files in directory
for file in *.html; do
jekyll-pandoc-exports -f "$file" -o exports/
done
When to Use Which¶
| Scenario | Use |
|---|---|
| Normal Jekyll site workflow | jekyll export |
| Fast PDF/DOCX iteration without rebuild | jekyll export |
| Validate data.yml before export | jekyll export --validate |
| Debug Pandoc/LaTeX issues | jekyll export --dry-run |
| Convert standalone HTML files | jekyll-pandoc-exports CLI |
| External build system integration | jekyll-pandoc-exports CLI |
| One-off file conversion | jekyll-pandoc-exports CLI |
Troubleshooting¶
"No export targets found"¶
The jekyll export command requires:
- A built site (
bundle exec jekyll buildfirst) - Pages with
pdf: trueordocx: truein front matter
"Site destination not found"¶
Run bundle exec jekyll build before bundle exec jekyll export.
Pandoc errors¶
Use --dry-run to see the exact command, then run it manually for detailed error output:
Schema validation failures¶
Fix the reported issues in _data/data.yml. Common problems:
- Missing required fields (name, email, tagline)
- Experience entries without role/company/time
- YAML syntax errors (bad indentation, unclosed quotes)