-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Closed as not planned
Copy link
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙋 no/questionThis does not need any changesThis does not need any changes
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
@mdx-js/mdx@^3.1.0
Steps to reproduce
Minimal Version:
import http from 'node:http'
import {evaluate} from '@mdx-js/mdx'
import {renderToPipeableStream} from 'react-dom/server'
import * as runtime from 'react/jsx-runtime'
// Note: refresh the pane on the right to see changes.
http
.createServer(async function (_, response) {
const mdx = "\frac{d}"
const {default: Content} = await evaluate(mdx, runtime)
const {pipe} = renderToPipeableStream(Content({}))
pipe(response)
})
.listen(8080)Here is a code snippet from my program:
const render = useCallback(async (data: string) => {
const processedData = data.replaceAll("<!--", "{/*").replaceAll("-->", "*/}")
try {
const evalMarkdown = await compile(processedData, {
outputFormat: "function-body",
remarkPlugins: [remarkMath],
rehypePlugins: [[rehypeKatex, { macros }]]
})
try {
const { default: Content } = await run(evalMarkdown, {
...runtime,
baseUrl: import.meta.url
})
// @ts-ignore
setMdxContent(<Content />)
} catch (err) {
console.error(err)
return
}
} catch (error) {
console.error(error)
}
}, [])Actual behavior
This throws an error stating: ReferenceError: d is not defined
Problem is that I use KaTeX with this and when it tries to run this. It completely crashes my application and completely removes all the UI, so its not even that I could change the input to stop it.
Expected behavior
The actual behavior that should happen/what I want, is it not to throw an error for this and be able to handle it. And not crash my UI.
Runtime
Package manager
Operating system
Windows 11 Home 24H2
Build and bundle tools
Vite
Metadata
Metadata
Assignees
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙋 no/questionThis does not need any changesThis does not need any changes