From 50d7ed3ef3604c0ae722f80763cd7ae26282dfbe Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Mon, 20 Jul 2026 11:31:48 -0500 Subject: [PATCH] fix(docs-viewer): Add LaTex math formula rendering via KaTeX Add client-side LaTeX formula rendering to the Docs Viewer and implement a parser-safe server-side math stashing mechanism. Previously, LaTeX math expressions ($ .. $, $$ .. $$) were underdered. Protecting math blocks with underscore-based placeholders (e.g., ___MATH_BLOCK_37___) caused Python Markdown to parse the underscores into emphasis tags, displaying the literal placeholder text (e.g., _MATHBLOCK_37_) in the output HTML. This commit switches the staching mechanism to pure alphanumeric tokens (e.g., MATHBLOCKTOKEN{index}END), safely bypassing the Markdown parser before rendering the restored formulas via KaTex - Integrate KaTeX CSS and auto-render JS in layout.html - Add server-side math stashing with alphanumeric tokens in main.py - Mount ./app volume in docker-compose.yml for live code updates :wa --- docs/app/layout.html | 18 ++++++++++++++++++ docs/app/main.py | 39 +++++++++++++++++++++++++++++++++++++++ docs/docker-compose.yml | 1 + 3 files changed, 58 insertions(+) diff --git a/docs/app/layout.html b/docs/app/layout.html index f3cf6cd..fc441d5 100644 --- a/docs/app/layout.html +++ b/docs/app/layout.html @@ -10,6 +10,8 @@ + +