-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
[BUG] Parsing of the following markdown structure failed: {"type":"code","name":"N/A"}. #370
Comments
My guess is that you need to configure the codeMirrorPlugin to support code blocks without any language specified, by passing a |
I don't use the codeMirrorPlugin, and it's unnecessary for my purposes. Markdown inherently supports code blocks without the requirement to specify a language. This bug was also reproduced in the official live demo This issue is not critical but it would be nice to have it fixed. |
Perhaps my response was not clear. The editor supports code blocks without a language, but you need to configure it so that it actually knows what kind of editor to associate with such a code block. I suggested the codeMirror one, but you can also use whatever you wish, the docs include an example with a text area. |
@wp0403 Helps, but we should explicitly provide an empty string ('') const codeBlockLanguages = ['', ...]; // <- here
...
codeMirrorPlugin({
codeBlockLanguages: codeBlockLanguages.reduce((acc, language) => {
acc[language] = language;
return acc;
}, {}),
}),``` |
This would be great to have in the example in the docs. |
Description:
When using the MDXEditor in source mode and attempting to insert a code block using triple backticks (```), the editor fails to parse the markdown structure, resulting in a parsing error. This issue prevents users from adding code snippets to their markdown documents directly in the source mode.
Error Message:
Parsing of the following markdown structure failed: {"type":"code","name":"N/A"}. Steps to Reproduce:
Steps 2 reproduce
For example:
Expected Behavior:
The editor should correctly parse the code block enclosed in triple backticks, allowing the user to insert code snippets into their markdown document without encountering a parsing error.
Actual Behavior:
The editor displays a parsing error when attempting to insert a code block using triple backticks, preventing the user from successfully adding code snippets in source mode.
The text was updated successfully, but these errors were encountered: