Sanitize and expose statement HTML for math rendering; add client-side math renderer#54
Merged
enlorik merged 2 commits intoJun 23, 2026
Conversation
enlorik
marked this pull request as ready for review
June 23, 2026 20:58
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.
Motivation
tex-span, superscripts, subscripts) for client-side rendering while removing unsafe tags and attributes.Description
safeHtmltocfStatementParser.jsthat whitelists allowed tags and class prefixes and strips scripts, styles and other attributes, and return new HTML fieldsstatementHtml,inputSpecificationHtml, andoutputSpecificationHtmlalongside existing text fields.cfStatementParser.test.jsto expect the new HTML fields and to verify preservation of sanitized math markup.src/utils/renderMath.jsprovidingescapeHtml,normalizeLatex,renderMathExpression,renderMathInHtml, andtextToHtmlto convert LaTeX-like delimiters to safe HTML and to turn plain text into paragraph HTML.StatementHtmlinProblemWorkspace.jsxwhich usesrenderMathInHtmlandtextToHtmlas a fallback, and wire the statement/input/output sections to use the new HTML fields.ProblemWorkspace.cssfor.problem-workspace-stmt-text,.tex-span,.problem-workspace-mathand related elements.src/utils/renderMath.test.jswith unit tests for math rendering and update parser tests accordingly.Testing
cfStatementParser.test.jsunder the test runner and they succeeded.renderMathunit tests insrc/utils/renderMath.test.jsand they succeeded.Codex Task