github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.11k stars 4.19k forks source link

Shell: Incorrect syntax highlighting for command substitution using backticks with comment inside #3186

Closed Herst closed 7 years ago

Herst commented 8 years ago

All these would output (foo)()(bar), which is not what the syntax highlighting implies:

printf '(%s)' foo "`# '`" bar
printf '(%s)' foo "`# "`" bar
printf '(%s)' foo "`# '`" \
  bar
printf '(%s)' foo "`# "`" \
  bar
Alhadis commented 8 years ago

Syntax highlighting on GitHub is provided by TextMate-compatible grammars, which Linguist selects to provide code colouring. For shell-scripts, the highlighting is provided by atom/language-shellscript. You should report this issue there.

Herst commented 8 years ago

Oh, OK. It was https://help.github.com/articles/creating-and-highlighting-code-blocks/ ("We use Linguist to perform language detection and syntax highlighting.") that lead me here.

pchaigno commented 8 years ago

It was https://help.github.com/articles/creating-and-highlighting-code-blocks/ ("We use Linguist to perform language detection and syntax highlighting.") that lead me here.

@arfon Maybe this could be slightly rephrased to explain that Linguist only selects the grammars for syntax highlighting? I'm not sure what's the best way to redirect users to those grammars though :/

arfon commented 8 years ago

@arfon Maybe this could be slightly rephrased to explain that Linguist only selects the grammars for syntax highlighting?

Yeah, that's probably worth updating to make things a little clearer.

I'm not sure what's the best way to redirect users to those grammars though :/

I mean, this list is the source of truth here but the idea of sending people to a folder of Git submodules is literally the least user-friendly thing I think I've ever thought of...

Alhadis commented 8 years ago

We could add a README.md file to the vendor/ directory that lists what each language uses for syntax highlighting. Something like this, perhaps:

Obviously, this wouldn't be updated by hand: it'd be done automatically whenever bundle exec rake whatever is called.

arfon commented 8 years ago

Obviously, this wouldn't be updated by hand: it'd be done automatically whenever bundle exec rake whatever is called.

👍 love it.

Alhadis commented 8 years ago

I'll have a crack at it then. =) Will give me an excuse to brush up on my Ruby skills. Which're currently so rusty, I installed cargo instead of gem.

That might very well be the funniest thing I'll say, ever.

EDIT: For those who don't get it.

Alhadis commented 8 years ago

Righto, actioned. This is the first serious Ruby script I've ever written, so go easy on me, heh.