Skip to content

Fix premature closure of cloze when inside MathJax#4612

Open
athith-g wants to merge 1 commit intoankitects:mainfrom
athith-g:mathjax-in-cloze
Open

Fix premature closure of cloze when inside MathJax#4612
athith-g wants to merge 1 commit intoankitects:mainfrom
athith-g:mathjax-in-cloze

Conversation

@athith-g
Copy link

The cloze tokenizer in rslib/src/cloze.rs previously treated any occurrence of }} as a cloze terminator, even when it appeared inside MathJax expressions.

Example:
{{c1:: ( \frac{1}{ \sqrt{ \pi }} ) }}

The }} from \sqrt{\pi}} would cause the cloze to terminate early, resulting in incorrect parsing and rendering.
Screenshot 2026-03-14 at 11 17 21 AM

Screenshot 2026-03-14 at 11 17 46 AM

normal_text() now tracks when the scanner is inside a MathJax region (\(...\) or \[...\]). While inside MathJax, }} is ignored as a cloze terminator.

Cloze openings are still recognized inside MathJax.

* FIX premature cloze termination inside MathJax

* ADD regression test for MathJax cloze parsing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant