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

Syntax highlighting bleeds out of markdown codeblocks #489

Open
aryzing opened this issue Apr 5, 2018 · 1 comment
Open

Syntax highlighting bleeds out of markdown codeblocks #489

aryzing opened this issue Apr 5, 2018 · 1 comment

Comments

@aryzing
Copy link

aryzing commented Apr 5, 2018

When writing jsx codeblocks in markdown files, I believe that the syntax highlighting is provided by language-babel. However, when trying to close the codeblock, the syntax highlighting for jsx bleeds outside the closing ```.

image

@gandm
Copy link
Owner

gandm commented Apr 5, 2018

This is problematic. The Markdown grammar should end the JS parsing when it finds a ``` but because of the way TextMate grammars work it will only see the ``` at the topmost rule stack of the called grammar. In my case when a `const`, `let` or `var` is detected I call a new `rule stack` which isn't terminated until an end or new statement is detected ( a semi-colon, EOF or JS keyword - if, else etc) so markdown isn't processing the ```.

I could put a check in for a line containing only ``` and terminate the rule stack but ``` is actualy valid JS so I'm a bit loathe to do so.

You could just put a ; at the end of the statement or on a new line and it will work. For normal code that doesn't end on a var definition of this type it should work without semi-colons. Not ideal if you don't like semi's!

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

2 participants