---
applyTo: "src/assets/src/presentations/**"
applyTo: "src/assets/src/diagrams/**"
applyTo: "src/assets/Makefile"
---

# Presentations & Diagrams Instructions

## Presentations (Typst)

Presentations are authored in **Typst** under `src/assets/src/presentations/` and compiled to flat PDFs in `src/assets/out/`.

**Build commands:**
```bash
cd src/assets
make decks              # Build all decks
make cultreel-deck-public
make cultreel-deck-insider
make cultsync-deck
```

## PDF edge / clipping scan (required)

After any change to a Typst deck source, always run a bbox edge-scan to catch near-edge text before it becomes visible clipping.

```bash
cd src/assets

# 1) Build the deck you changed
target="slate-mo-deck"  # set to the relevant Makefile target
make "$target"

# 2) Extract word bounding boxes and fail if any word is too close to a page edge
tmpdir="${TMPDIR:-/tmp}"; mkdir -p "$tmpdir/pdf-scan"
pdf="out/${target}.pdf"
xml="$tmpdir/pdf-scan/bbox.xml"

pdftotext -bbox-layout "$pdf" "$xml"

python3 - "$xml" 6 <<'PY'
import sys
import xml.etree.ElementTree as ET

xml_path = sys.argv[1]
threshold_pt = float(sys.argv[2])

tree = ET.parse(xml_path)
root = tree.getroot()

bad = []
for page in root.findall('.//{*}page'):
    bbox = page.attrib.get('bbox')
    if not bbox:
        continue
    px0, py0, px1, py1 = map(float, bbox.split())

    hits = 0
    for word in page.findall('.//{*}word'):
        wb = word.attrib.get('bbox')
        if not wb:
            continue
        x0, y0, x1, y1 = map(float, wb.split())
        if min(x0 - px0, y0 - py0, px1 - x1, py1 - y1) <= threshold_pt:
            hits += 1

    if hits:
        bad.append((int(page.attrib.get('number', '0')), hits))

for n, hits in bad:
    print(f"page {n}: edge_hits<={threshold_pt:g}pt: {hits}")

raise SystemExit(1 if bad else 0)
PY
```

## Diagrams

Diagrams are **pre-rendered SVG assets** under `src/assets/src/diagrams/` and are included by Typst.

```bash
cd src/assets
make diagrams  # No-op; diagrams live as SVGs in src/diagrams/
```

## Documentation Strategy

- Presentation and diagram specifics should live alongside the Typst source in `src/assets/src/presentations/**` and `src/assets/src/diagrams/**`.
- The Makefile in `src/assets/Makefile` is the source of truth for available build targets.
