feat: add LaTeX to Markdown#1734
feat: add LaTeX to Markdown#1734wusteven815 merged 9 commits intodeephaven:mainfrom wusteven815:feat-1720-latex
Conversation
|
A few notes:
|
|
Check how big the katex.css file is, Don is concerned about size of loading it up front. |
It's 23KB |
|
@dsmmcken at 23kb I wouldn't be concerned about the extra weight |
|
For the linting issue, add You can also do |
|
Replace 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)': [
'babel-jest',
{
rootMode: 'upward',
plugins: ['@deephaven/babel-preset/mockCssImportPlugin'],
},
],
},
// 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/(?!(${nodeModulesToTransform.join('|')})/)`,
],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
path.join(__dirname, './__mocks__/fileMock.js'),
'^fira$': 'identity-obj-proxy',
'^monaco-editor$': path.join(
__dirname,
'node_modules',
'monaco-editor/esm/vs/editor/editor.api.js'
),
// Handle monaco worker files
'\\.worker.*$': 'identity-obj-proxy',
// All packages except icons use src code
'^@deephaven/(?!icons)(.*)$': path.join(__dirname, './packages/$1/src'),
},
testEnvironment: 'jsdom',
setupFilesAfterEnv: [path.join(__dirname, './jest.setup.ts')],
}; |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1734 +/- ##
==========================================
- Coverage 46.48% 46.07% -0.42%
==========================================
Files 617 627 +10
Lines 37289 37625 +336
Branches 9378 9470 +92
==========================================
+ Hits 17335 17336 +1
- Misses 19900 20235 +335
Partials 54 54
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
mattrunyon
left a comment
There was a problem hiding this comment.
Due to our Vite config, the lazy loading doesn't actually offload much (only about 2.5kB). The vendor bundle increases from 792kB gzipped to 1417kB gzipped
I'll see if we can fix this. There was some reason we manually specified chunks and I think it was to split out monaco and plotly. I believe there was also some memory usage issue w/ the source maps and everything in 1 giant chunk
| // plotly.js dependencies | ||
| 'd3-interpolate', | ||
| 'd3-color', | ||
| // react-markdown and its dependencies |
There was a problem hiding this comment.
@mattrunyon this looks like it was fun to figure out
react-markdownto8.0.7remark-gfmto4.0.0rehype-katex 6.0.3remark-math 5.1.1