The feature for being able to override language prettification is good. But if a language is unknown, it seems to "just guess". Note the lower code sample when I specify lang-rebol:


The color usage is nonsensical, and it looks a a lot better with no highlighting...which I can get by specifying lang-none:


Whether this is a "bug" or a "feature request" is a matter of opinion. It's at least a bit lossy in my view, because at the moment of writing the post, the person might know the language (as is this case). They would rather it be prettified if supported, but lang-none is their only alternative.

One "future proof" way is to agree on the lang-XXX tags now, even for languages not currently supported by Google Code Prettify. Then if you use an unknown language, just fall back to monochrome text.

UPDATE: even better -- if for certain language tags the "guesser" could be selectively disabled, and then only turn on if you put in a language tag. It would be best to be off for everything in by default and no need to put in these comments at all...

  • The current behavior is expected in my opinion. Like any other unwhitelisted HTML tag, <!-- language: lang-rebol --> is silently ignored. Specifying an unsupported language for language specification is, well, unsupported.
    – Dennis
    Oct 19, 2012 at 23:28
  • @Dennis My skin already crawls just thinking about how semantic information is being poked into comments, and has to be parsed out separately...especially with those redonko delimiters. But the cosmic joke that is today's Internet aside: wouldn't my idea about agreeing on the tags for unsupported languages make it a "known unknown" instead of an "unknown unknown", and thus whitelistable? Oct 19, 2012 at 23:38
  • I'm not saying your idea is bad, but I fail to see how it's an improvement over the current implementation. If lang-rebol does not exist, don't add it to the question. lang-x might be "future proof" for a language called REBOL, but the specifiers for JavaScript, Python, C++ and C# could have just as easily been called something else. If google-code-prettify implements REBOL some day, the [rebol] tag should be enough anyway.
    – Dennis
    Oct 20, 2012 at 0:15
  • @Dennis The problem I'm having is stated in the question. The prettification that is guessed makes an incorrect guess, and causes random distracting colorization. So if I have to go in and put a language-specifying comment anyway, I'd rather that comment say "rebol" and not "none", since I know what it is. Oct 20, 2012 at 0:38
  • ...although actually, the idea of being able to turn off prettification for certain language tags by default would be great. If the default was off for things in [rebol] instead of guessing, that's much better--no comment needed. Added above. Oct 20, 2012 at 0:44
  • 2
    (Rebol GCP does indeed exist!)
    – rgchris
    Mar 6, 2014 at 7:14


You must log in to answer this question.

Browse other questions tagged .