6

I tried to highlight some code in this answer, by inserting an explicit

<!-- language-all: python -->

at the top of the file.

I also tried <!-- language: python --> just before the block of code, and have replaced python by py (as the latter is mentioned on meta-stackexchange) in both.

None of these seem to trigger highlighting of the python code. I am doing something wrong, but what is it?

6

The problem was python, which tells it to use the syntax highlighting associated with the tag , which for some reason was set to "none". I changed it now, so both the methods you described will work. In the future, you can also directly specify a language from the list in that meta post (instead of specifying a tag), but you need to prefix it with lang, e.g. <!-- language: lang-py -->.

See What is syntax highlighting and how does it work?

  • 1
    Thanks, I read the syntax-highlighting for code in the help, but looked at the example ( <!-- language: c# -->) more than closely reading the text and follow the links. And I know this had worked for me (but that was on Stack Overflow) – Anthon Sep 6 '14 at 7:17

You must log in to answer this question.

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