Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes while streaming data & converting to markdown #602

Closed
ItzCrazyKns opened this issue Sep 10, 2024 · 1 comment
Closed

App crashes while streaming data & converting to markdown #602

ItzCrazyKns opened this issue Sep 10, 2024 · 1 comment
Assignees

Comments

@ItzCrazyKns
Copy link

ItzCrazyKns commented Sep 10, 2024

When we stream data (in my case from a chatbot) to the frontend and then parse the markdown using markdown-to-jsx if the chatbot starts outputting a code block the app would crash (only for HTML). This happens as:

Since we stream the responses from chatbot the chatbot starts the code with opening the code block and then starts writing its HTML but since the code block isn't closed markdown-to-jsx detects it as plain HTML and renders it inside a <p> tag which causes DOM errors as the <html> tag cannot be a child of the <p> tag.

I believe markdown-to-jsx should detect the starting of the code block and till the code block is not closed by '```' it should just detect the chars after the starting as the code.

@willtpwise
Copy link

We're facing a similar issue where invalid markdown causes a CPU blowout. We essentially need a way to handle markdown which contains invalid html/markdown. Perhaps there's a way to strip this invalid markup or escape it?

@quantizor quantizor self-assigned this Nov 13, 2024
quantizor added a commit that referenced this issue Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants