Pandoc Setup and Brand Pipeline Guide

Setup instructions for Pandoc with Solanasis brand templates for multi-format document generation from Markdown.


1. Overview

Pandoc is a universal document converter (GPL-licensed) that converts Markdown to PDF, DOCX, HTML, EPUB, and 50+ other formats. For Solanasis, Pandoc serves as the “Swiss army knife” bridge: Markdown source branded PDF (via Typst engine) or branded DOCX (via reference document). This is the most versatile tool for multi-format output from a single Markdown source, making it ideal for deliverables that need to ship in multiple formats.


2. Installation (WSL2)

Install Pandoc

sudo apt install pandoc

Verify installation

pandoc --version

PDF output engine options

  • Typst (recommended): Ensure Typst is installed per the Typst setup guide (typst-setup-and-brand-template-guide). Fastest compilation, best quality-to-complexity ratio.
  • LaTeX (not recommended): sudo apt install texlive-xetex (4GB+ install). Only needed for academic documents or if Typst is unavailable.

3. PDF via Typst Engine

Basic command

pandoc input.md -o output.pdf --pdf-engine=typst

With custom Solanasis template

pandoc input.md -o output.pdf --pdf-engine=typst --template=solanasis-pandoc.typ

About Pandoc-Typst templates

The Pandoc Typst template is different from a standalone Typst template. It wraps Pandoc’s variable system, allowing YAML frontmatter in Markdown to feed into the template. Key variables: $title$, $author$, $date$, $body$.

Solanasis Pandoc-Typst template

Save the following as solanasis-pandoc.typ (recommended location: solanasis-scripts/templates/pandoc/solanasis-pandoc.typ):

#let navy = rgb("#020532")
#let copper = rgb("#C47A3D")
#let parchment = rgb("#FEF9F1")
#let charcoal = rgb("#111827")
 
#set page(paper: "us-letter", margin: (top: 1.2in, bottom: 1in, left: 1in, right: 1in))
#set text(font: "Montserrat", size: 11pt, fill: charcoal)
#show heading.where(level: 1): set text(font: "Playfair Display", fill: navy, size: 24pt)
#show heading.where(level: 2): set text(font: "Montserrat", weight: "bold", fill: copper, size: 16pt)
 
// Title block
#align(center)[
  #text(font: "Playfair Display", size: 28pt, fill: navy)[$title$]
  #v(8pt)
  #text(size: 12pt, fill: copper)[$author$ | $date$]
]
#v(24pt)
#line(length: 100%, stroke: 0.5pt + copper)
#v(12pt)
 
$body$

Usage with YAML frontmatter

Write Markdown with YAML frontmatter that feeds into the template variables:

---
title: "Security Assessment Report"
author: "Dmitri Zasage, CEO — Solanasis LLC"
date: "April 2026"
---

Then compile:

pandoc report.md -o report.pdf --pdf-engine=typst --template=solanasis-pandoc.typ

Brand color reference

NameHexUsage in template
Navy#020532H1 headings, title text
Copper#C47A3DH2 headings, author/date line, horizontal rule
Parchment#FEF9F1Available for page background (add fill: parchment to #set page)
Charcoal#111827Body text

4. DOCX via Reference Document

Concept

Pandoc uses a .docx reference document for styling. You create a branded reference doc once; all future DOCX output inherits its styles (headings, fonts, colors, headers, footers).

Create the reference document

pandoc -o solanasis-reference.docx --print-default-data-file reference.docx

Then open solanasis-reference.docx in Word or LibreOffice and set these styles:

StyleFontSizeColor
Heading 1Playfair Display24ptNavy #020532
Heading 2Montserrat Bold16ptCopper C47A3D
Body TextMontserrat11ptCharcoal #111827
First ParagraphMontserrat11ptCharcoal #111827

Additional styling:

  • Page background: Parchment FEF9F1 (optional — may not render in all viewers)
  • Header: Solanasis logo + “Solanasis LLC”
  • Footer: “solanasis.com | Page X”

Usage

pandoc input.md -o output.docx --reference-doc=solanasis-reference.docx

Storage location

Store the reference doc at: solanasis-scripts/templates/pandoc/solanasis-reference.docx


5. Multi-Format Pipeline

The core value of Pandoc: one Markdown source, many output formats.

# From a single Markdown source:
pandoc proposal.md -o proposal.pdf --pdf-engine=typst --template=solanasis-pandoc.typ
pandoc proposal.md -o proposal.docx --reference-doc=solanasis-reference.docx
pandoc proposal.md -o proposal.html --standalone --css=solanasis.css

All three commands use the same proposal.md source. Content is written once; formatting is handled by templates/reference docs.

Typical workflow

  1. Claude generates Markdown with YAML frontmatter
  2. Run Pandoc with the appropriate template for each requested format
  3. Deliver PDF to client, keep DOCX for client editing, host HTML internally

Format selection guide

FormatCommand flagTemplate/ReferenceBest for
PDF--pdf-engine=typst --template=solanasis-pandoc.typTypst templateFinal deliverables, printing
DOCX--reference-doc=solanasis-reference.docxReference DOCXClient-editable documents
HTML--standalone --css=solanasis.cssCSS stylesheetWeb hosting, email embedding

6. Integration with solanasis-scripts

  • Pandoc templates should live in solanasis-scripts/templates/pandoc/
  • The reference DOCX and Typst template are the two key assets to maintain
  • Future generate-doc.py enhancement could add --engine pandoc flag for multi-format output
  • Pandoc pairs naturally with AI-generated Markdown: Claude writes content with YAML frontmatter, Pandoc renders to any format

Directory structure

solanasis-scripts/
  templates/
    pandoc/
      solanasis-pandoc.typ         # Typst template for PDF output
      solanasis-reference.docx     # Reference doc for DOCX styling
      solanasis.css                # CSS for HTML output (optional)

7. Troubleshooting

  • “Typst not found as PDF engine”: Ensure typst is in PATH; run which typst. If missing, install per typst-setup-and-brand-template-guide.
  • “Reference doc styles not applying”: Style names must match Pandoc’s expected names (Heading 1, Heading 2, Body Text, First Paragraph). See the Pandoc docs on reference docs.
  • “Special characters breaking LaTeX output”: Use Typst engine instead (--pdf-engine=typst) — Typst handles special characters cleanly without escaping.
  • “pandoc: command not found”: Run sudo apt install pandoc to install. Verify with pandoc --version.
  • Font not rendering in PDF: Ensure fonts (Playfair Display, Montserrat) are installed system-wide: sudo apt install fonts-google-montserrat or download from Google Fonts and install to ~/.local/share/fonts/.

8. References


Last updated: 2026-04-12