7

I created an answer here: https://stackoverflow.com/a/11934671/1442342

But the Python syntax is not highlighting.

Does the tag not give a highlighting hint or have I done something wrong?

0
11

Apparently not; I've added the tag to the question and the code highlighting is now working.

I've also removed the tag from that question though, it is not the right tag for the question.

For future reference, you can also mark your code blocks with an explicit code hint:

<!-- language: lang-py -->

See How do I format my code blocks? for details.

4

I set lang-py as the code language used for syntax highlighting for the tag. It was previously set to none (the default). This should fix the problem for any other questions tagged but not .

1

The reason is that the version-specific tags need to be explicitly added by the admins/mods in order to pick up syntax highlighting for the base language, in cases where the base tag (or any other tag that defaults to the same language) is not included. I complained about this for SQL Server 2008 R2 and SQL Server 2012:

"sql-server" type tags not defaulting to SQL-lang for the code editor (prettify)

The general solution going forward seems to be to add explicit version tags to the syntax highlighter as they come out, rather than solve for all potential versions using regex or wildcards. Which I think is more scalable but seems to be opposed.

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