Skip to content

Commit 7d63884

Browse files
feat: add mathjax config
1 parent fb8a4db commit 7d63884

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/App.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { MathJaxContext } from 'better-react-mathjax';
1414

1515
import './App.scss';
1616
import Head from './components/Head';
17+
import { mathJaxConfig } from "./utils";
1718

1819
export const App = ({ courseMetadata, isEnabled }) => (
1920
<Router>
@@ -27,7 +28,7 @@ export const App = ({ courseMetadata, isEnabled }) => (
2728
/>
2829
{!isEnabled && <DemoWarning />}
2930
<main data-testid="main">
30-
<MathJaxContext>
31+
<MathJaxContext config={mathJaxConfig}>
3132
<ListView />
3233
</MathJaxContext>
3334
</main>

src/utils/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as StrictDict } from './StrictDict';
22
export { default as keyStore } from './keyStore';
3+
export { default as mathJaxConfig } from './mathJaxConfig';

src/utils/mathJaxConfig.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const mathJaxConfig = {
2+
version: 2,
3+
tex2jax: {
4+
inlineMath: [
5+
['$', '$'],
6+
['\\(', '\\)'],
7+
['[mathjaxinline]', '[/mathjaxinline]'],
8+
],
9+
displayMath: [
10+
['$$', '$$'],
11+
['\\[', '\\]'],
12+
['[mathjax]', '[/mathjax]'],
13+
],
14+
processEscapes: true,
15+
},
16+
CommonHTML: { linebreaks: { automatic: true } },
17+
SVG: { linebreaks: { automatic: true } },
18+
"HTML-CSS": { linebreaks: { automatic: true } },
19+
messageStyle: 'none',
20+
styles: {
21+
'.MathJax_SVG svg': { 'max-width': '100%' },
22+
'table>tbody>tr>td>.MathJax_SVG svg': { 'max-width': 'inherit' },
23+
},
24+
};
25+
26+
export default mathJaxConfig;

0 commit comments

Comments
 (0)