| name | export-pdf |
| description | Prepare and export a markdown document to PDF with Bekk branding. Use when the user wants to convert markdown to PDF, export a document, or create a professional PDF report. |
| allowed-tools | Read, Edit, Write, Bash(bekk-pdf *) |
Export Markdown to PDF
Prepare a markdown document for PDF export by fixing known issues, then convert using bekk-pdf.
Target file: $ARGUMENTS
Step 1: Read and Analyze the File
Read the markdown file and identify issues that need fixing:
- Missing YAML front matter - Document needs title for cover page
- Vertical Mermaid diagrams -
graph TD or graph TB should be graph LR
- ASCII art diagrams - Box-drawing characters that should be Mermaid
- Emojis - Should be replaced with text in professional documents
- Complex tables - Too many columns or long headers
Step 2: Fix Issues
2.1 Add YAML Front Matter (if missing)
If the document lacks front matter, add it at the top:
---
title: [Infer from document content or first heading]
subtitle: [Optional - infer if appropriate]
author: Bekk Consulting
date: [Current month and year in Norwegian, e.g., "Februar 2026"]
confidential: false
---
2.2 Convert ALL Vertical Diagrams to Horizontal (KRITISK)
Vertikale diagrammer ser uprofesjonelle ut i PDF. De tar for mye vertikal plass og etterlater store tomrom på sidene.
ALLTID konverter:
graph TD → graph LR
graph TB → graph LR
flowchart TD → flowchart LR
flowchart TB → flowchart LR
INGEN UNNTAK for flytdiagrammer - selv komplekse diagrammer med subgraphs skal være horisontale.
Eneste unntak: sequenceDiagram (er horisontalt av natur, med vertikal tidsakse - dette er korrekt).
Hvis et diagram har subgraphs, må du også sikre at innholdet i subgraphs flyter horisontalt:
graph LR
subgraph Frontend
A[React] --> B[Redux]
end
subgraph Backend
C[API] --> D[DB]
end
B --> C
2.3 Convert ASCII Art to Mermaid
Look for code blocks containing box-drawing patterns like:
+--+, |, -->, ─, │, ┌, ┐, └, ┘
Convert these to Mermaid graph LR diagrams.
Example conversion:
# From:
+--------+ +--------+
| Client |---->| Server |
+--------+ +--------+
# To:
```mermaid
graph LR
A[Client] --> B[Server]
### 2.4 Replace Emojis with Text
| Find | Replace with |
|------|--------------|
| ✅ ✓ ☑️ | OK |
| ❌ ✗ ☒ | Feil |
| ⚠️ ⚡ | Advarsel |
| ℹ️ | Info |
| 💡 | Tips |
| 🔶 🟡 | Delvis |
| 🟢 | OK |
| 🔴 | Feil |
| 🇳🇴 or other flags | [Remove or describe] |
| 👍 | OK |
| 👎 | Feil |
For tables with status columns, prefer text: "OK", "Feil", "Delvis", "Venter", "Pagar"
### 2.5 Simplify Complex Tables
If a table has:
- More than 5 columns → Consider splitting or restructuring
- Very long column headers → Shorten them
- Long text in cells → Move to description section below table
## Step 3: Show Changes
After making edits, briefly summarize what was changed:
- Number of diagrams converted from TD to LR
- Number of ASCII diagrams converted to Mermaid
- Number of emojis replaced
- Any tables restructured
- Front matter added/updated
## Step 4: Export to PDF
Run the conversion:
```bash
bekk-pdf [filepath]
Step 5: Confirm Success
Report the result:
- PDF created successfully at [path]
- Any warnings from the conversion
Notes
- Norwegian characters (ÆØÅ) work fine - no changes needed
- Sequence diagrams should stay vertical (that's their nature)
- If user provides output filename as second argument, use it
- The PDF opens automatically on macOS