Skip to content

Commit 434930a

Browse files
authored
feat: add LaTeX to Markdown (#1734)
- Adds #1720 - Updated `react-markdown` to `8.0.7` - Updated `remark-gfm` to `4.0.0` - Installed `rehype-katex 6.0.3` - Installed `remark-math 5.1.1` - Some of these are not the latest versions to match compatibility (with React 17) - Updated Jest config for pure ESM libraries (thanks to @mattrunyon)
1 parent 6c13763 commit 434930a

8 files changed

Lines changed: 17552 additions & 12209 deletions

File tree

jest.config.base.cjs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
const path = require('path');
22

3+
// List of node_modules that need to be transformed from ESM to CJS for jest to work
4+
const nodeModulesToTransform = [
5+
// monaco
6+
'monaco-editor',
7+
// plotly.js dependencies
8+
'd3-interpolate',
9+
'd3-color',
10+
// react-markdown and its dependencies
11+
'react-markdown',
12+
'vfile',
13+
'vfile-message',
14+
'unist-util.*',
15+
'unified',
16+
'bail',
17+
'is-plain-obj',
18+
'trough',
19+
'remark.*',
20+
'mdast-util.*',
21+
'micromark.*',
22+
'decode-named-character-reference',
23+
'trim-lines',
24+
'property-information',
25+
'hast-util.*',
26+
'.*separated-tokens',
27+
'ccount',
28+
'devlop',
29+
'escape-string-regexp',
30+
'markdown-table',
31+
'zwitch',
32+
'longest-streak',
33+
'rehype.*',
34+
'web-namespaces',
35+
'hastscript',
36+
];
37+
338
module.exports = {
439
transform: {
540
'.(ts|tsx|js|jsx)': [
@@ -10,9 +45,11 @@ module.exports = {
1045
},
1146
],
1247
},
13-
// Makes jest transform monaco, but continue ignoring other node_modules. Used for MonacoUtils test
48+
// Makes Jest transform some node_modules when needed. Usually because they are pure ESM and Jest needs CJS
49+
// By default, Jest ignores transforming node_modules
50+
// When switching to transform all of node_modules, it caused a babel error
1451
transformIgnorePatterns: [
15-
'node_modules/(?!(monaco-editor|d3-interpolate|d3-color)/)',
52+
`node_modules/(?!(${nodeModulesToTransform.join('|')})/)`,
1653
],
1754
moduleNameMapper: {
1855
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',

0 commit comments

Comments
 (0)