Christian Schlichtherle
Christian Schlichtherle

Reputation: 3155

google-code-prettify doesn't add the classes to SPAN tags for Java code

I'm trying to integrate google-code-prettify to my site in order to prettify Java code. I followed the instructions at http://google-code-prettify.googlecode.com/svn/trunk/README.html. I can verify that I get SPAN elements for the tokens in the code samples, so the lexing seems to work. However, the generated SPAN tags miss the class attribute and thus the CSS cannot prettify it. Also I recognized that the SPAN tags should probably be generated in lowercase, but they are in uppercase.

Any clues what might be wrong?

Upvotes: 1

Views: 261

Answers (1)

Christian Schlichtherle
Christian Schlichtherle

Reputation: 3155

OK, I got it: The document was starting with an XML declaration:

<?xml version="1.0" encoding="UTF-8"?>

This seems to confuse the Javascript code somehow. Once I removed the declaration, the highlighting worked.

Upvotes: 1

Related Questions