borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
558 stars 18 forks source link

Markdown code block with syntax specified breaks following text #184

Open YuriGor opened 5 years ago

YuriGor commented 5 years ago

Anonymous code blocks works fine, but code blocks with syntax js or javascript make following text after code scoped as a string.

image

here is a text sample: https://gist.github.com/YuriGor/acb356c1803b0ea75ebeb865d48f28ef

Svish commented 5 years ago

Confirmed. Just ran into this myself. Quite annoying. 😕

Thought first it was related to the ` being a string literal thing in javascript, which it probably is, but semi-colons seem to somehow mess with it too:

1 2
acnebs commented 5 years ago

Interesting because this is the opposite problem that other markdown syntax highlighters have, where any "invalid" syntax (e.g. NOT ending a line with a semicolon) will break highlighting for the rest of the markdown.

I doubly ran into this issue because I use JsPrettier to auto-format my files on save, and it was adding a semicolon to the end of my JS blocks. 😂

If anyone else is having that issue, you can tell JsPrettier to ignore markdown files, but you can also add <!-- prettier-ignore --> right above the code block, which is what I opted for until this bug can be fixed.