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 jquery 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.
<
's and>
's. See my tests in the sandbox. But at least the the original languages are not being included anymore. :)