Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I think it used to work in the past but now code highlight has no effect on JavaScript whatsover.

jQuery example:

$(document).keypress(function (event) {
    var key = String.fromCharCode(event.which);
    $("#Container li").each(function (index) {
        var text = $(this).text();
        if (text.length > 0 && text.charAt(0).toLowerCase() == key.toLowerCase())

Pure javascript example:

<script type="text/javascript">
    for (var i = 0; i < 5; i++) {
        alert("hello" + i);

Has anything changed? Maybe I'm doing something wrong?

share|improve this question

closed as off-topic by Gilles, Al E., Nathan Tuggy, Ward, rene Mar 25 at 21:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question pertains only to a specific site in the Stack Exchange Network. Questions on Meta Stack Exchange should pertain to our network or software that drives it as a whole, within the guidelines defined in the help center. You should ask this question on the meta site where your concern originated." – Gilles, Al E., Nathan Tuggy, Ward, rene
If this question can be reworded to fit the rules in the help center, please edit the question.

Working fine on SO? Like… But indeed: not here… – Arjan Dec 12 '10 at 13:17
@Arjan so is this just me? :-/ – Shadow Wizard Dec 12 '10 at 13:20
I don't think it's just you, I've noticed HTML formatting off the past 2 days as well, something definitely changed...I spent a while yesterday trying to format a post for syntax highlighting for HTML and gave up...when noticed several questions with the same issues - having proper markdown. This question leads me to believe there were changes:… not sure if that was the cause or another symptom of some other change. – Nick Craver Dec 12 '10 at 13:30
@Nick thanks for confirming.. hope some mod will jump by and fix it soon. :) – Shadow Wizard Dec 12 '10 at 13:38
@Shadow - tagged it syntax-highlighting as well, hopefully it'll get some love – Nick Craver Dec 12 '10 at 13:41
@Shadow, I assume the first link in the comment works for you too, but the 2nd does not? So no, it's not just you, but it depends on the post (or more likely: its content). See also the Formatting Sandbox. – Arjan Dec 12 '10 at 13:41
@Arjan yep first link show the highlight fine. Wonder how this can be reproduced? Going to mess around in the Sandbox.. :) – Shadow Wizard Dec 12 '10 at 13:47
@Shadow, just in case you don't know: the successful highlighting blocks have <pre class="prettyprint">, as used by a JavaScript code prettifier. – Arjan Dec 12 '10 at 13:57
@Arjan cool.. can we add this manually somehow?? – Shadow Wizard Dec 12 '10 at 14:00
Just add class="prettyprint" (like using Firebug, or Chrome's Web Inspector), and then run javascript:prettyPrint() in the location bar. That will indeed make your examples work just fine. It seems the class="prettyprint" is just lacking in the HTML. – Arjan Dec 12 '10 at 14:02
up vote 6 down vote accepted

We are experimenting with prettify language hints based on tags. Expect changes and a subsequent meta post outlining this soon.

share|improve this answer
Here is the meta post:… – Jon Seigel Dec 13 '10 at 4:49
Cheers, added javascript tag to… and highlight working as expected. Sweet! :) – Shadow Wizard Dec 13 '10 at 8:55

Somehow the erroneous blocks are currently rendered like:

<div class="post-text">

...rather than

<div class="post-text">
  <pre class="prettyprint">

(And the code prettifier needs that class.)

share|improve this answer

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