[BUG] {"type":"code","name":"N/A"}. if bad/misspelled language in codeblock is provided in *source* mode
Opened this issue · 2 comments
"@mdxeditor/editor": "^3.4.0",
Editor throws error Parsing of the following markdown structure failed: {"type":"code","name":"N/A"}.
when adding a non-existing language code block in the source view OR after modifying source after creating a codeblock in editor view.
This seems to be related to #423
Steps to reproduce:
Option 1:
- Go to https://mdxeditor.dev/editor/demo
- write ```jss
- hit space.
- A default code block is created succesfully
- switch to source view
- edit in any place. add a space or something
- go back to editor view, notice the error message.
Option 2:
- Go to https://mdxeditor.dev/editor/demo
- go to source view
- write ```jss
- hit enter
- write ```
- Go back to view mode. Notice the error message
Wondering what should the correct behavior be. An early error? Not creating a code block at all?
IMO it should just allow a similar behavior as when we are doing in the editor: create a block with the "default" language or to a "no language / text" block.
The option 1 case might also be confusing for users as they are allowed to misspell the language in editor view, but it will break later if/when the modify the source