4

I think Markdown google-code-prettify has some incorrect lexical rules for Java (and possibly other languages).

It correctly identifies this code block from SO question 1485832 as being written in Java:

Gl.glLoadIdentity();
float tamaño = texto.Tamaño;
double tan = texto.Orientacion.Y / texto.Orientacion.X;

but as you can see, the syntax highlighting of one of the identifiers is messed up. I am guessing that it does not consider the non-ASCII character 'ñ' to be part of an identifier, whereas Java itself does consider it to be part of the identifier.

  • 2
    I'd love to support i18n identifiers properly, but JS doesn't have support for unicode character classes. Replacing every \w in a regex with several kB of unicode character ranges would bloat the download. If you have any ideas about how to support i18n identifiers without exploding download sizes, I'd love to here them. – Mike Samuel Dec 10 '09 at 18:27
  • I found this question looking at how to get syntax highlighting working in a code editor extension. It's a shame that the question is marked as a duplicate. That cited question is not very helpful, at least not directly. – Fuhrmanator Dec 27 '19 at 18:32
4

Submit a patch! :)

http://code.google.com/p/google-code-prettify/

We just deployed the latest trunk of prettify.js ; revision 83

http://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.js