Skip to main content
2 of 5
edited tags
Makoto
  • 106.2k
  • 120
  • 864
  • 1.3k

Can we make syntax highlighting easier?

It seems as though often the syntax highlighter does not detect the language I'm working in.

When this happens, I try to be responsible and apply the manual highlighting comment: <!-- language: NAME -->.

However, it's hard for me to remember this syntax because it is finicky.

Consider the following examples of the highlighting comment with subtle changes in spacing:

<!-- language: python -->

for i in range(10):
  print('hi')

<!--language: python -->

for i in range(10):
  print('hi')

<!-- language: python-->

for i in range(10):
  print('hi')

<!--language:python-->

for i in range(10):
  print('hi')

<!-- language:python -->

for i in range(10):
  print('hi')

<!-- language: python -->

for i in range(10):
  print('hi')

In all cases, the comments are detected as such, but in only some cases is highlighting applied as a result.

Is there a way to make this command less finicky and, hopefully, thereby easier to use?

Richard
  • 60.7k
  • 14
  • 9