I just want to report something that appears to be a bug. Adding language hints to code blocks has been working great so far. If we give it a hint, it will give us the right highlighting right? Well, most of the time...

It appears that some JavaScript code in the site is changing what prettify stuff gets applied to the code blocks. As far as I could tell, the HTML that gets sent to us looks OK. When a code block gets an override, the block will get the applied language along with the prettyprint-override class (as I've shown in Cannot apply same language hint in multiple code blocks). But, if you were to look at the effective HTML through Firebug (or other tool), it gets replaced with the language that was hinted and regular old prettyprint with whatever language the question's tags would have given.

Now most of the time, we wouldn't even notice a problem. However seeing Shadow Wizard's post in the sandbox, if you look at the linked question, something strange happens.

The question is tagged with which applies the default language. He edited the question to apply the HTML hint for the HTML block in the question, but it doesn't appear to be working. It looks like it's being given the default look as normal. If you look at the raw HTML, you'd see for the block:

<pre class="lang-html prettyprint-override">

But, if you look through Firebug, you'd see this:

<pre class="lang-html default prettyprint">

It looks like default is winning here, so it doesn't get rendered as HTML.

As far as I could tell, the prettyprint-override changed to default prettyprint when the page loaded up. I could understand the change to use prettyprint, but it should have left out the original language. I don't think this is intended behavior.

It should be corrected.

  • Interestingly, even after the fix your particular example doesn't look right. I guess prettify can't handle the beestings.
    – balpha StaffMod
    Commented Jul 3, 2011 at 19:54
  • @balpha: Yeah, I was thinking that too. But it wasn't "pure" HTML, so I guess prettify is choking on it seeing all the extra <'s and >'s. See my tests in the sandbox. But at least the the original languages are not being included anymore. :) Commented Jul 3, 2011 at 19:59

1 Answer 1


Fixed in the next build.

We were handling the questions "Is this a codeblock that should be prettified?" and "Does this codeblock have an explicit language set?" in the wrong order, causing – as you noticed – two languages to appear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .