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

Please add a "prettyprint" CSS class when explicitly defining class with

<!-- language: something -->

regardless of there being no valid language tag.

It is inspired by question Syntax highlighting not working.

share|improve this question
1  
what is the problem with the current highlighting? –  WarrenFaith Mar 7 '11 at 15:25
1  
@Warren, it doesn't work, unless Prettyprint has already been enabled using tags. See Manually specify language for syntax highlighting for today's enhancements to the earlier Changes to syntax highlighting. The latter was only based on tags, but those tags are still needed to make manually specifying the language work. –  Arjan Mar 7 '11 at 16:07
1  
I'd say it's a bug, not a feature request? –  Arjan Mar 7 '11 at 16:08

2 Answers 2

up vote 5 down vote accepted

Code with no matching tags for language will now be prettified if they have an override after the next deploy.

share|improve this answer
1  
What does the override syntax look like? –  jjnguy Mar 7 '11 at 18:36
    
<!-- language: something --> like above –  Geoff Dalgas Mar 7 '11 at 19:11
    
@jjnguy, see Manually specify language for syntax highlighting. –  Arjan Mar 7 '11 at 19:16
    
@Arjan, @Geoff, thanks. –  jjnguy Mar 7 '11 at 19:54
    
@jjnguy, just in case you read the linked post before I merged Kevin's edit: this is all based on tag names, not on language names. –  Arjan Mar 7 '11 at 19:56
    
Confirmed. But it seems the class is added to the HTML upon saving, so the few existing cases (if any) where it's lacking need a dummy edit. –  Arjan Mar 7 '11 at 22:58
    
@Arjan you are correct. –  Geoff Dalgas Mar 7 '11 at 23:00

To enhance on this a bit: without any language tags in the question, the following should work too. After the first deployment it did output <pre class="lang-html"><code> ... </code></pre> but without the additional class="prettyprint" the syntax highlighting was not triggered.

<!-- language: html -->

    While not hinted otherwise: <html> source <b>goes</b> "here".

<!-- language: javascript -->

    var a = 3;
    while(not (a > 0)){
      alert("JavaScript code <b>goes</b> here.");
    }

This rendered without highlighting, but meanwhile things have been fixed. A new (dummy) save of the post gets one the expected highlighting:

While not hinted otherwise: <html> source <b>goes</b> "here".
var a = 3;
while(not (a > 0)){
  alert("JavaScript code <b>goes</b> here.");
}

The preview uses the default Prettify, which is fine to me.

share|improve this answer

You must log in to answer this question.

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