-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove 'katex' from @khanacademy/perseus (#1428)
## Summary: KaTeX was retired from use in Perseus in 2023. Today, I noticed that we still reference the `katex` package in the perseus `package.json`, but we never import it anywhere in the code. So I'm removing that dependency. I've also updated some code comments and storybook references to not mention KaTeX anymore. I've left some references to CSS classes and the KaTeX_Main font ref. I'm unsure if they might be important somewhere (especially if host applications may still set it outside of Perseus). So this doesn't fully remove all references to katex, but it moves us another step closer. Issue: "none" ## Test plan: `yarn tsc` `yarn lint` I ran storybook and opened the `ZoomableTex` stories and played with them. Note(jeremy): I've restored the code that swaps `\begin{align}` to `\begin{aligned}` and noted LEMS-1608 based on comments from Ben (thanks!). ~I also went to the `EditorPage` story and pasted in the following Tex into the **Question** field (which uses the macro that we used to have to replace for KaTeX, but MathJax supports properly: switching `\begin{align}` to `\begin{aligned}`).~ Author: jeremywiebe Reviewers: jeremywiebe, benchristel, Myranae, nicolecomputer Required Reviewers: Approved By: benchristel Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1428
- Loading branch information
1 parent
8b02682
commit eb9f3f9
Showing
13 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus": minor | ||
--- | ||
|
||
Drop katex dependency - no longer used |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
6 changes: 4 additions & 2 deletions
6
...ages/perseus/src/util/katex-preprocess.ts → packages/perseus/src/util/tex-preprocess.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
/** | ||
* Preprocess TeX code to convert things that KaTeX doesn't know how to handle | ||
* Preprocess TeX code to convert things that MathJax doesn't know how to handle | ||
* to things is does. | ||
*/ | ||
|
||
export default (texCode: string): string => | ||
texCode | ||
// Replace uses of \begin{align}...\end{align} which KaTeX doesn't | ||
// support (yet) with \begin{aligned}...\end{aligned} which renders | ||
// the same is supported by KaTeX. It does the same for align*. | ||
// TODO(kevinb) update content to use aligned instead of align. | ||
// TODO(LEMS-1608) Remove this replacement as MathJax supports the | ||
// "align" macro correctly (and, in fact, it is not synonymous with | ||
// "aligned"). | ||
.replace(/\{align[*]?\}/g, "{aligned}") | ||
// Replace non-breaking spaces with regular spaces. | ||
.replace(/[\u00a0]/g, " "); |
This file contains 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
This file contains 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