jonschlinkert / sublime-markdown-extended

Top 100 Sublime Text plugin! Markdown syntax highlighter for Sublime Text, with extended support for GFM fenced code blocks, with language-specific syntax highlighting. YAML Front Matter. Works with ST2/ST3. Goes great with Assemble.
https://github.com/jonschlinkert
MIT License
660 stars 96 forks source link

Language names are case-sensitive, indented code blocks do not highlight #157

Open nickbclifford opened 7 years ago

nickbclifford commented 7 years ago

I was trying to view a snippet of the Ruby Style Guide in Sublime, but I noticed that all the Ruby sections weren't being highlighted. It took me a while, but I soon realized why this happens. In the original Markdown, the language header is ```Ruby instead of ```ruby and the three backticks are indented with two spaces. Once I changed the case and removed the indentation, it started highlighting properly again. Is there a way to fix this?

In case it matters, I am using a self-tweaked version of the Monokai Neue theme.

image image image

jonschlinkert commented 7 years ago

Is there a github convention on this by any chance? I'd be happy to make languages case-insensitive, but only if it's in accordance with github's GFM conventions.

nanoant commented 7 years ago

I just came across the same problem today. This is not explicitly explained in GFM specification, but yes, GFM parser assumes that indented fenced code blocks may belong to the list item content if its indent matches.

https://help.github.com/articles/creating-and-highlighting-code-blocks/

And here's some Kramdown parser discussion about this issue: https://github.com/gettalong/kramdown/issues/123

Altogether I think you should enable fenced codeblocks also when they're preceeded with any number of tabs or spaces.