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
659 stars 96 forks source link

dd in shell fenced block causes wrong highlighting #56

Closed tummychow closed 7 years ago

tummychow commented 10 years ago

Try this with the highlighting set to bash:

$ dd if=/dev/zero of=swapfile bs=1M count=512
$ mkswap swapfile

The if in the dd command is interpreted as a conditional keyword, so now I guess the grammar is looking for the matching fi. As a result, the fenced block doesn't end at the second set of backticks (it thinks the backticks are a command substitution string). You can see GitHub's syntax highlighter is actually making the same mistake, since the if is bolded, but the fenced block doesn't end up consuming this entire issue, so it's not quite as bad.

Not sure if there's an easy solution to this problem. From what I know, dd's command syntax is quite specific, and doesn't allow for a space before the equals sign. Maybe that can be used to solve this issue (check for a space after if before interpreting it as a keyword`, but I wouldn't be surprised if that was insufficient.

jonschlinkert commented 10 years ago

seems like a tough one, we'll probably just need to keep this open until someone comes up with a solution. thanks for letting us know!

jonschlinkert commented 7 years ago

punting to https://github.com/jonschlinkert/sublime-markdown-extended/issues/142

molomby commented 6 years ago

Looks like the same issue in a slightly different context:

screen shot 2017-09-29 at 3 36 05 pm I'm on..

Can we get this reopened?

doowb commented 6 years ago

@molomby #142 is opened to track this issue. I updated the comment above to point to it.