Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERACTIVE SICP-JS: Switch math parsing library to KaTeX #1801

Merged
merged 2 commits into from
Jun 18, 2021

Conversation

samuelfangjw
Copy link
Contributor

@samuelfangjw samuelfangjw commented Jun 17, 2021

Description

This PR replaces the current MathJax based library (better-react-mathjax) with a KaTeX based library react-latex-next.

This change results in a huge speedup, with most pages loading almost instantly now. For comparison, new library on left and old library on right. (I haven't pulled the latest changes for the older version, so the font looks a bit smaller).

Screen.Recording.2021-06-17.at.10.31.48.PM.mov

Downsides: React KaTeX does not support all the features of MathJax. However, we can circumvent this by replacing tags in the JSON files that are not recognised with ones that are see this PR.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Check that math equations are parsed properly.

Checklist

  • I have tested this code
  • I have updated the documentation

@coveralls
Copy link

coveralls commented Jun 17, 2021

Pull Request Test Coverage Report for Build 946836761

  • 7 of 8 (87.5%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 30.167%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/pages/sicp/Sicp.tsx 1 2 50.0%
Totals Coverage Status
Change from base Build 946733930: -0.01%
Covered Lines: 3229
Relevant Lines: 9871

💛 - Coveralls

Copy link
Member

@martin-henz martin-henz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks gook

@martin-henz martin-henz merged commit 558f213 into source-academy:master Jun 18, 2021
@samuelfangjw samuelfangjw deleted the katex branch June 18, 2021 06:08
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.

None yet

3 participants