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 was reading this question, and the code is displaying all in red (the colour normally reserved for strings).

I could perhaps understand no syntax highlighting (though the question is tagged Python), but why red?

share|improve this question
up vote 2 down vote accepted

It's using the tag to do the syntax highlighting, not the tag:

<pre class="lang-regex prettyprint">
    <span class="str">import re<br>

Given the list of languages in Changes to syntax highlighting, which does include Python (as py), it seems Python is not recognized as a language (yet) to get it the correct lang-py class.

Though it is in Jeff's list, Python-only questions currently use default rather than lang-py, like:

<pre class="default prettyprint">
    <span class="pln">... </span>

Even more surprising: it seems to me that lang-regex is not even supported by Prettify? But I guess I'm looking at some old list.

share|improve this answer
But why? I thought if a question had two language tags, it would use "default". – sepp2k Dec 16 '10 at 21:09
Aha, maybe python needs to be known as py, to be recognized as Python, @sepp2k? Other Python-only questions, example, seem to be rendered as default, not as lang-py. – Arjan Dec 16 '10 at 21:19
Strange. [python] shows up in Jeff's list of tag mappings (line 12), but maybe something went wrong with it – Michael Mrozek Dec 16 '10 at 21:27
I was just looking at that list too, @Michael. Surely regex is there too, but I fail to find any clue about support for lang-regex in the list of Prettify-supported languages... – Arjan Dec 16 '10 at 21:32

We have switched both python and regex to use the "default" prettify syntax highlighting. Regex was supported in prettify however wasn't creating the most ideal output.

share|improve this answer
Did you already make that switch 30 minutes ago? As then Python was already rendering as default anyhow -- which seems odd, unless of course you were working on it. – Arjan Dec 16 '10 at 21:52
Python was already set to default. – Geoff Dalgas Dec 16 '10 at 22:14
What's the reason for setting python to default? Doesn't that mean that if I tag a question e.g. C# and python ("What's the python equivalent for this C# feature"), it'll be highlighted as C#? Wouldn't this problem just as easily be fixed by setting python to python, so python+regex gives the default highlighting because it has two language tags? – sepp2k Dec 17 '10 at 12:53
What's the reason for setting Python to "default"? Does this mean that "<!-- language: lang-py -->" has no effect? I'm confused because Jeff has included "lang-py" in this list and this list but not in this list, this list or this list. – ShreevatsaR Jun 18 '11 at 1:59

You must log in to answer this question.

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