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

Broken yaml code block syntax highlighting #48

Closed
s-weigand opened this issue Mar 3, 2022 · 2 comments · Fixed by #64
Closed

Broken yaml code block syntax highlighting #48

s-weigand opened this issue Mar 3, 2022 · 2 comments · Fixed by #64

Comments

@s-weigand
Copy link

s-weigand commented Mar 3, 2022

First of all thanks for the awesome extension 😄

When trying it out I found that the syntax highlighting for yaml is broken.
For example this code snipped

```yaml
foo:
    bar: [1,2]
```

Without the extension, it renders like this
image
And after installing the extension
image

Html markup without extension
image
Html markup with extension
image

Maybe there is a way to tell markdown-it to ignore yaml and yml?

Other code blocks like python and js work normally.

@agoose77
Copy link
Owner

agoose77 commented Mar 3, 2022

I can reproduce this, but I'm not initially sure what the cause is. jupyterlab-markup is receiving the highlight request, and passing it off to CM5, but I think something is going wrong thereafter.

@bollwyvl
Copy link
Contributor

bollwyvl commented Jul 9, 2022

This is actually the case for any mode which hasn't been loaded yet (a few are blessed, e.g. JSON, markdown, python). If it's loaded before the render occurs, it should work: for example, creating a .yml file and opening it with the editor, then re-opening a markdown file which has a yaml code block looks correct.

A quick look upstream suggests, after determining which mode is needed, we need to call await Mode.ensure(spec)... somewhere around here... which of course we can't have, directly, because asynchrony.

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

Successfully merging a pull request may close this issue.

3 participants