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

[BUG] {"type":"code","name":"N/A"}. if bad/misspelled language in codeblock is provided in *source* mode #474

Open
ajboni opened this issue Jun 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ajboni
Copy link

ajboni commented Jun 2, 2024

"@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:

  1. Go to https://mdxeditor.dev/editor/demo
  2. write ```jss
  3. hit space.
  4. A default code block is created succesfully
  5. switch to source view
  6. edit in any place. add a space or something
  7. go back to editor view, notice the error message.

Option 2:

  1. Go to https://mdxeditor.dev/editor/demo
  2. go to source view
  3. write ```jss
  4. hit enter
  5. write ```
  6. Go back to view mode. Notice the error message

image

@ajboni ajboni added the bug Something isn't working label Jun 2, 2024
@petyosi
Copy link
Contributor

petyosi commented Jun 3, 2024

Wondering what should the correct behavior be. An early error? Not creating a code block at all?

@ajboni
Copy link
Author

ajboni commented Jun 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants