6

I'm seeing code text with a variety of colors. Two recent examples:

In this image taken from the first one, there's text in light blue, dark blue, and red.

code text colors

And poking about, the light blue has "span class" typ, the dark blue is kwd and the dark red is lit. Other text is pln.

Is this a Winter Bash thing or is it the way code text will appear for the foreseeable future?

3
  • 1
    I believe they started detecting languages to avoid <!-- language: -->.
    – Kulfy
    Dec 24, 2018 at 12:25
  • I looked at U&L a bit but didn't come across anything similar.
    – DK Bose
    Dec 24, 2018 at 12:28
  • @DKBose that’s just because they are too lazy to format their posts properly ]:-)
    – dessert
    Dec 24, 2018 at 13:53

1 Answer 1

9

What you are seeing there is syntax highlighting. This can be formatted explicitly in a post, for example, you can turn on Bash syntax highlighting for a code snippet by adding a tag before it:

<!-- language: lang-bash -->

Syntax highlighting is also applied automatically according to a post's tags. In this case, the question has the tag , so all code in the question and all of its answers will be displayed with Python 3 syntax highlighting.

This is often not what you want... for example the question relates to Python but is mainly about package management and contains a code-formatted block of APT output. You can turn off syntax highlighting with a tag like this:

<!-- language: lang-none -->

or to turn off all syntax highlighting in a post

<!-- language-all: lang-none -->

For more information see What is syntax highlighting and how does it work? | MSE.

3
  • Has it always been there and I just didn't notice? Or is this part of the new responsive design theme?
    – DK Bose
    Dec 24, 2018 at 12:32
  • I'm itching to remove the python3 tag for that question.
    – DK Bose
    Dec 24, 2018 at 12:33
  • 2
    @DKBose it's been there for as long as I've been using the site... I am now afk but I will find something on MSE later! Feel free to re-tag as appropriate
    – Zanna Mod
    Dec 24, 2018 at 12:37

You must log in to answer this question.

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