feat: speak display math + switch TTS rewrite to gemma4:e4b - #148
Merged
Conversation
Display math was silently skipped: Quartz emits $$...$$ as a <span class="katex-display"> that is a sibling of paragraphs, not inside one, so the block selector (p, li, dt, dd, h1-h6) never collected it. Verified across the built site: all 402 katex-display spans sat outside any block element, so every standalone equation was dropped from the reading. Fix: add .katex-display to BLOCKS; the existing nested-block filter and the data-tex path in textOf handle the rest, so each display equation becomes its own chunk carrying its full LaTeX (533 pure-math blocks surfaced corpus-wide). Also switches the rewrite model from qwen2.5-coder:7b to gemma4:e4b with think: false, per eval: - semantic suite: 18/18 both, but gemma has 0/15 residual LaTeX on real blocks vs qwen's 1/15 - warm rewrites ~2.5s vs 3.4-4.0s; cold prompt eval 28s vs 49s - timeline replay (stable-matching, warm): wall 122.4s for 120.2s of audio, llm avg 5.4s max 6.8s (vs qwen 127.7s wall, max 18.5s) gpt-oss:20b matched semantically but ran 2-3x slower; gemma2:2b failed the suite (11/18) and was rejected. CACHE_VERSION bumped to 6 so stale qwen rewrites regenerate. Verified on a display-math-heavy note (static-timing-analysis, 24 chunks, 11 LLM-bound after the fix): warm replay 0.7s to first audio, one 1.6s stall, wall 188.9s for 186.5s of audio.
This was referenced Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two changes to the TTS reader:
Speak display math. Quartz emits
$$...$$as a<span class="katex-display">that is a sibling of paragraphs, not inside one, so the block selector (p, li, dt, dd, h1-h6) never collected it. Verified across the built site: all 402katex-displayspans sat outside any block element — every standalone equation on every note was silently dropped from the reading. Fix: add.katex-displaytoBLOCKS. The existing nested-block filter and thedata-texpath intextOfhandle the rest; each display equation becomes its own chunk carrying its full LaTeX. This surfaced 533 pure-math blocks corpus-wide that were previously inaudible.Switch the rewrite model to
gemma4:e4b(think: false). Eval vs the shippedqwen2.5-coder:7b(both with the S3 prompt):CACHE_VERSIONbumped to 6 so stale qwen rewrites regenerate.Sample readings (display equations, gemma4:e4b)
t_h \leq t_{input,i} \leq T_{clk} - t_s ~ \forall i→ "t h is less than or equal to t input i is less than or equal to T clock minus t s for all i"T = \frac{80 \times 10^9 bytes}{3.35 \times 10^{12} bytes/s} \approx 23.9 ms→ "T equals eighty times ten to the nine bytes over three point three five times ten to the twelve bytes per second approximately twenty three point nine milliseconds"Verification
think: false, and cache v6.