Skip to content

Commit

Permalink
feat: add LaTeX to Markdown (#1734)
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
wusteven815 authored Feb 8, 2024
1 parent 6c13763 commit 434930a
Show file tree
Hide file tree
Showing 8 changed files with 17,552 additions and 12,209 deletions.
41 changes: 39 additions & 2 deletions jest.config.base.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
const path = require('path');

// List of node_modules that need to be transformed from ESM to CJS for jest to work
const nodeModulesToTransform = [
// monaco
'monaco-editor',
// plotly.js dependencies
'd3-interpolate',
'd3-color',
// react-markdown and its dependencies
'react-markdown',
'vfile',
'vfile-message',
'unist-util.*',
'unified',
'bail',
'is-plain-obj',
'trough',
'remark.*',
'mdast-util.*',
'micromark.*',
'decode-named-character-reference',
'trim-lines',
'property-information',
'hast-util.*',
'.*separated-tokens',
'ccount',
'devlop',
'escape-string-regexp',
'markdown-table',
'zwitch',
'longest-streak',
'rehype.*',
'web-namespaces',
'hastscript',
];

module.exports = {
transform: {
'.(ts|tsx|js|jsx)': [
Expand All @@ -10,9 +45,11 @@ module.exports = {
},
],
},
// Makes jest transform monaco, but continue ignoring other node_modules. Used for MonacoUtils test
// Makes Jest transform some node_modules when needed. Usually because they are pure ESM and Jest needs CJS
// By default, Jest ignores transforming node_modules
// When switching to transform all of node_modules, it caused a babel error
transformIgnorePatterns: [
'node_modules/(?!(monaco-editor|d3-interpolate|d3-color)/)',
`node_modules/(?!(${nodeModulesToTransform.join('|')})/)`,
],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
Expand Down
Loading

0 comments on commit 434930a

Please sign in to comment.