-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch math parsing library to katex (#1801)
- Loading branch information
1 parent
39798d1
commit 558f213
Showing
9 changed files
with
83 additions
and
157 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
import { MathJax } from 'better-react-mathjax'; | ||
import * as React from 'react'; | ||
import Latex from 'react-latex-next'; | ||
|
||
type SicpLatexProps = { | ||
math: string; | ||
inline: boolean; | ||
}; | ||
|
||
const SicpLatex: React.FC<SicpLatexProps> = props => { | ||
const { math, inline } = props; | ||
|
||
return ( | ||
<MathJax inline={inline} dynamic={false}> | ||
{math} | ||
</MathJax> | ||
); | ||
return <Latex>{props.math}</Latex>; | ||
}; | ||
|
||
export default SicpLatex; |
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
28 changes: 10 additions & 18 deletions
28
src/pages/sicp/subcomponents/__tests__/__snapshots__/SicpLatex.tsx.snap
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,25 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Sicp latex renders correctly block 1`] = ` | ||
"<MathJaxContext version={3} config={{...}}> | ||
<SicpLatex math=\\"1+1\\" inline={false}> | ||
<MathJax inline={false} dynamic={false}> | ||
<span id={[undefined]} style={{...}}> | ||
1+1 | ||
</span> | ||
</MathJax> | ||
</SicpLatex> | ||
</MathJaxContext>" | ||
"<SicpLatex math=\\"1+1\\" inline={false}> | ||
<Latex delimiters={{...}} strict={false}> | ||
<span className=\\"__Latex__\\" dangerouslySetInnerHTML={{...}} /> | ||
</Latex> | ||
</SicpLatex>" | ||
`; | ||
|
||
exports[`Sicp latex renders correctly inline 1`] = ` | ||
"<MathJaxContext version={3} config={{...}}> | ||
<SicpLatex math=\\"1+1\\" inline={true}> | ||
<MathJax inline={true} dynamic={false}> | ||
<span id={[undefined]} style={{...}}> | ||
1+1 | ||
</span> | ||
</MathJax> | ||
</SicpLatex> | ||
</MathJaxContext>" | ||
"<SicpLatex math=\\"1+1\\" inline={true}> | ||
<Latex delimiters={{...}} strict={false}> | ||
<span className=\\"__Latex__\\" dangerouslySetInnerHTML={{...}} /> | ||
</Latex> | ||
</SicpLatex>" | ||
`; |
Oops, something went wrong.