7

I often use the syntax-highlighting feature of Stack Exchange in order to make my code easier to read.

```lang-python
for k in range(0, 10):
    print(k)
```
for k in range(0, 10):
    print(k)

There are many different ways to capitalize a string such as lang-python:

  • Lang-Python
  • LANG-Python
  • lang-PYTHON

Is the language tag case sensitive for syntax highlighting? I often mistype it and write something like "lang-Pythn" but no error messages are displayed.

1 Answer 1

10

Tl;dr lang- must be lowercase, capitalization on the language name can be anything


Let's try it out in the formatting sandbox:

All lowercase:

```lang-python
for i in range(10):
    if i % 2:
        print(i)
```
for i in range(10):
    if i % 2:
        print(i)

All caps:

```LANG-PYTHON
for i in range(10):
    if i % 2:
        print(i)
```
for i in range(10):
    if i % 2:
        print(i)

Language name all caps:

```lang-PYTHON
for i in range(10):
    if i % 2:
        print(i)
```
for i in range(10):
    if i % 2:
        print(i)

All mixed caps:

```LaNg-PyThOn
for i in range(10):
    if i % 2:
        print(i)
```
for i in range(10):
    if i % 2:
        print(i)

Language name mixed caps:

```lang-PyThOn
for i in range(10):
    if i % 2:
        print(i)
```
for i in range(10):
    if i % 2:
        print(i)
1
  • 8
    Note that the lang- part is not required.
    – 41686d6564
    Aug 22, 2022 at 3:06

You must log in to answer this question.

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