Skip to content

Matching | Render LaTeX in answer choice chips - #81

Merged
BrianGenisio merged 1 commit into
mainfrom
feat/matching-choice-latex
Oct 19, 2026
Merged

BrianGenisio merged 1 commit into
mainfrom
feat/matching-choice-latex

Conversation

@BrianGenisio

Copy link
Copy Markdown
Contributor

Matching suggested answers with $$...$$ now render as math on the choice chips and on the selected card. Scoring still compares the raw suggested-answer string to [[blank:...]].

Changes

Matching choices used textContent, so learners saw dollar signs instead of formulas. The parser now includes choicesHtml for each chip. choices stays the raw string so blank matching is unchanged.

The chip is a flex .button. Chrome treated the sentence and the KaTeX tree as sibling flex items, which wrapped into two columns and split y=x^2. Content now sits in a single .matching-choice-label block, and the formula is white-space: nowrap.

Testing

  • npm test
  • npm run examples, open matching-latex-chips.md
  • Confirm suggested answers render as math, not $$y=x^2$$
  • Place a chip on a card. When the label wraps, the formula should stay on one line with the surrounding sentence, not in a second column

Co-authored-by: Cursor <cursoragent@cursor.com>
@BrianGenisio

Copy link
Copy Markdown
Contributor Author

@coderrabbit review

@BrianGenisio
BrianGenisio merged commit 821305d into main Oct 19, 2026
2 checks passed
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