Notes renderer — unified multi-format export via content negotiation

Parent: gdata-server/todo

Goal: the HTML renderer (notes_web.py) should serve any note in a requested output format chosen purely by content type / format selector — request the type, get the appropriate output — through one integrated path, not a separate CLI tool. The visual formats (HTML, PDF, PostScript, PNG) should share a single render so they always match.

Formats to support

Key requirement: the visual exports must cover SVG diagrams

PDF/PostScript/PNG must include inline SVG blocks (diagrams), which the current exporter does not. This is the main gap — a note that is mostly diagrams must export faithfully, not as text-only.

Current state (2026-10-24)

negotiate_format() in notes_web.py supports only html / json / markdown / plain / yaml; Accept: application/pdf returns None → HTTP 406 (pinned by test_serve_note_406_body). PDF exists solely as a separate CLI, notes_to_pdf.py, whose pipeline is pandoc → groff(ms) → ps2pdf — markdown-based, so it drops SVG diagrams entirely. See gdata-server/http-formats.

Implementation notes

Raised 2026-10-24. Interim workaround: cairosvg exports an SVG block to a vector PDF ad hoc (cairosvg x.svg -o x.pdf, merge with pdfunite) — see the authoring/export tips in notes-browser/svg-diagrams.

tags todo, notes-server, gdata-server, renderer, pdf