36

I just noticed that the prettify language hint for questions tagged has been changed to lang-default; it was lang-css before. While this allows HTML code blocks to be highlighted as HTML, unfortunately it prevents CSS code blocks from being highlighted as CSS. So now instead of adding the lang-html hint to HTML code blocks, I now have to add lang-css to CSS code blocks!

What's the reason for this change? (Note, only developers and moderators have the ability to change the prettify language for a given tag.)

Also, if I try to change it back to lang-css, I get this prompt:

Setting a language to a value other than default should ONLY be done if the odds of a XML, Javascript, or HTML code block in the same post is very low,are you sure you wish to make this change?

And then I'm reminded of that question I asked not too long ago, linked above, regarding highlighting HTML code blocks in questions with lang-css, and then I cancel and step back on making the change.

Is there something else going on with prettify and HTML/CSS code blocks behind the scenes that I'm not aware of? It'd be great if a developer working on integrating prettify with the site could help me understand this.

8
  • 5
    Oh and there's a space missing between "low," and "are" in the prompt. Commented Feb 9, 2012 at 16:50
  • 6
    That comma should be a semicolon anyway...
    – mmyers
    Commented Feb 9, 2012 at 16:52
  • @mmyers: Indeed. Commented Feb 9, 2012 at 16:52
  • 1
    Also, "an XML", not "a XML". Commented Feb 9, 2012 at 17:27
  • 1
    Also, "JavaScript", not "Javascript". Commented Feb 9, 2012 at 17:27
  • 1
    CSS syntax highlighting appears to be broken right now. I had to add <!-- language: lang-css --> to make the CSS highlighting for this work.
    – thirtydot
    Commented Feb 13, 2012 at 15:07
  • @thirtydot: Yes, that's why I brought this up. I should have mentioned it in this question, so I've edited it now. Commented Feb 13, 2012 at 15:18
  • I think you should change it back to lang-css for the time being. Broken HTML is better than broken CSS. At least, I was used to the broken HTML highlighting.. Although, that might make this bug report more difficult to understand.
    – thirtydot
    Commented Feb 13, 2012 at 15:22

1 Answer 1

5
+200

I changed it in anger that both html and javascript in questions were not being properly styled, while css (which I loathe :) was.

I was unaware of the previous meta discussion - we can change it back if the community wants.

14
  • 2
    Ha, I knew it! Well, I think it's better to change it back as we (well, I) have added lang-html hints to a number of posts, as well as what thirtydot said. Is there anything else that can be done about the three languages not playing together with prettify though? :/ Commented Feb 17, 2012 at 19:53
  • I changed it back, but now should we go through and add html hints to every other answer on the question thirtydot linked? I personally don't feel css is more important than javascript and html coloring (insert adage about opinions and a-holes :) Commented Feb 17, 2012 at 20:46
  • OK, clearly I didn't think that through... from the looks of it, right now deciding on a workaround is between adding hints for HTML and JS, and adding hints for CSS... this was actually why I was hesitant on changing it back myself when I saw the prompt. But I digress — my main gripe here is that the three languages can't highlight correctly together without explicit hints on at least one of them, and I'm hoping that can be addressed somehow. If it can't, though, then I'd rather not upset you ;) Commented Feb 17, 2012 at 21:15
  • I don't know how to fix this, other than submitting patches for prettify. Making the internet a better place, man! Get to it! Commented Feb 18, 2012 at 3:08
  • @bolt Jarrod is right about this. No way in hell CSS is more important than JavaScript, much less HTML. Commented Feb 21, 2012 at 9:02
  • @Jeff, Jarrod: I think I finally get what you mean by "more important". I concede, and have changed it back to lang-default. (The rest of the community apart from thirtydot and myself don't seem to care.) Sorry for the trouble. Commented Feb 21, 2012 at 12:12
  • @Bolt no trouble; it highlights that prettify, while usually awesome, has a wee bit of (understandable) trouble with multiple language detection. Commented Feb 21, 2012 at 18:26
  • 1
    I submitted an issue about this. The author of Prettify is on Stack Overflow.
    – thirtydot
    Commented Feb 24, 2012 at 0:41
  • @thirtydot: Well, it looks more complicated than we thought. Check out his last reply to the issue. Commented Apr 3, 2012 at 5:37
  • Has this happened again? This question isn't getting the syntax highlighting it deserves.
    – Ry-
    Commented Jul 30, 2012 at 1:34
  • @minitech it looks correct to me. If you want css to be highlighted specifically, the language hint needs to be applied to the code block. Commented Aug 2, 2012 at 20:55
  • 1
    @JarrodDixon: Well, the question's only language tag is CSS, so shouldn't it be highlighted as CSS by default?
    – Ry-
    Commented Aug 3, 2012 at 16:06
  • 5
    Isn't this part of a much larger issue then? Surely if multiple tags are provided then lang-default should be enforced, or the first tag specified should enforce the language. I don't see why a question tagged with only CSS shouldn't have lang-css applied by default, and equally I don't see why a question more heavily weighed towards CSS should use something else as the default. I prefer HTML and JavaScript over CSS so I removed it is a really lazy answer. Commented May 30, 2013 at 22:05
  • @James Donnelly: It is, but unfortunately that "much larger issue" is something that isn't exactly within our control. See the link in thirtydot's comment. Commented Jun 17, 2013 at 18:17

You must log in to answer this question.

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