30

While tinkering with a Sass-related answer today, I realised that the Sass syntax highlighting is pretty broken. It doesn't even recognise comments properly. Here's an illustrative snippet:

Screenshot showing broken syntax highlighting

Now, I realise that

Stack Exchange does not have its own syntax highlighting engine. It uses Google Code Prettify. Therefore, any bugs and feature requests regarding syntax highlighting cannot be handled by Stack Exchange and should be directed to the team behind Google Code Prettify.

However, my question is what I, as a user, should do when writing or editing a Sass answer (or an answer involving any other currently unsupported language). If I use a <!-- language: none --> language hint, then if support for Sass does get added to Google Code Prettify (which it probably will), the answer won't update to have correct syntax highlighting unless somebody edits it. But if I don't add a <!-- language: none --> hint, then the syntax highlighting will be broken to the point of silliness until Google Code Prettify adds support.

What should I do?

6
  • 2
    In this specific case, does lang-css not work a little better? The default highlighting is based on the question's tags, so here the highlighter is probably thinking this code is Ruby.
    – jscs
    Apr 19, 2014 at 18:42
  • 1
    @JoshCaswell Oddly, <!-- language: ruby --> and <!-- language: css --> result in identical highlighting in the case of the code blocks in the linked question.
    – Mark Amery
    Apr 19, 2014 at 18:46
  • 10
    Use the language codes. I don't think either ruby or css are valid options, meaning the default kicks back in. <!-- language: lang-ruby --> ( or <!-- language: rb -->) and <!-- language: lang-css -->.
    – jscs
    Apr 19, 2014 at 18:48
  • 7
    @JoshCaswell Dammit - you are entirely right. What's more, <!-- language: lang-sass --> works beautifully. I never knew about the lang- prefix, having only read meta.stackexchange.com/a/81971/200582; only after your comment did I search and discover meta.stackexchange.com/questions/184108/…. Thanks for your help.
    – Mark Amery
    Apr 19, 2014 at 18:50
  • 6
    That's odd, Sass doesn't seem to be a supported language. SO must have an extension or two.
    – jscs
    Apr 19, 2014 at 18:55
  • 4
    @JoshCaswell Possibly from these guys, who have a Sass extension: github.com/hail2u/google-code-prettify-language-handlers
    – Mark Amery
    Apr 19, 2014 at 18:59

0

You must log in to answer this question.

Browse other questions tagged .