What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

This answer has the following content:

<!-- language: lang-js -->

    var d = $('#mydiv');
    // Move down by 50px
    d.css({top:d.position().top+50+'px'});

If I put it here, it looks correct:

var d = $('#mydiv');
// Move down by 50px
d.css({top:d.position().top+50+'px'});

However, in the answer the comment line is not being syntax colored as a comment. Why?

Edit: per the accepted answer below, I've fixed the formatting in my answer to workaround the limitation/bug, so the linked-to answer no longer demonstrates the problem.

share|improve this question
    
Note that I think that this was a problem before the question was closed, so I do not believe it to be related to that. –  Phrogz Feb 8 '12 at 15:40

1 Answer 1

up vote 2 down vote accepted

You have to add blank line before the <!-- language: lang-js --> line as well.

Not sure if it's a problem with "our" parser or Google Code Prettify module, but the above trick solve the issue.

share|improve this answer
    
Ah, great to know. Thanks. –  Phrogz Feb 8 '12 at 15:47
    
@Phrogz cheers, stumbled on this here in Meta some while ago don't remember where though. :) –  Shadow Wizard Feb 8 '12 at 15:50
    
I had big problem with this, finally I figured it out (add a blank line before). I also searched in Meta, couldn't find anything. Decided to write a suggestion, then finally I found this by following a link in the first question in the first suggestion in "Questions that may already have your answer". Can be me being slow minded, but shouldn't this info be a part of stackoverflow.com/editing-help#syntax-highlighting ? –  244an Feb 25 '13 at 20:03
    
@244an very true, there's already suggestion somewhere to add more details to the syntax highlight help page feel free to add this as well. :) –  Shadow Wizard Feb 25 '13 at 20:54

You must log in to answer this question.

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