Blog

All posts
John Damask · 2026-03-06
devlogbugslatexkatexcsp

The presentation modes feature from the day before broke LaTeX rendering. Claude was generating math content with inconsistent approaches -- sometimes MathJax, sometimes KaTeX, sometimes raw LaTeX -- and the CSP headers were blocking the CDN scripts for whichever library Claude chose. The fix was to standardize on KaTeX everywhere: a _ensure_katex() post-processor in generator.py that detects math content via regex patterns (\(, \[, $$, \begin{), strips any existing math library references Claude may have included, and injects a consistent set of KaTeX CSS, JS, and auto-render scripts. The CSP headers were updated to allow the KaTeX CDN (cdn.jsdelivr.net). After deploying, the DynamoDB prompts had to be force-updated since the deploy scripts use attribute_not_exists conditions that won't overwrite existing entries -- a gotcha that bit us and is now documented in CLAUDE.md.