Skip to main content
Changed alt text so that those who can't see the image get the information that only the first example works.
Source Link
BSMP
  • 4.8k
  • 10
  • 88
  • 109

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')

Since the foregoing doesn't display on Meta, I have an image:

Finicky highlighting syntaxOf the six examples above, only the first results in correct highlighting. All others display as plain pre-formatted text.

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?

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')

Since the foregoing doesn't display on Meta, I have an image:

Finicky highlighting syntax

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?

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')

Since the foregoing doesn't display on Meta, I have an image:

Of the six examples above, only the first results in correct highlighting. All others display as plain pre-formatted text.

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?

edited tags
Link
Servy
  • 203.7k
  • 105
  • 683
  • 806
added 155 characters in body; edited tags
Source Link
Richard
  • 60.7k
  • 14
  • 9

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')

Since the foregoing doesn't display on Meta, I have an image:

Finicky highlighting syntax

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?

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?

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')

Since the foregoing doesn't display on Meta, I have an image:

Finicky highlighting syntax

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?

edited tags
Link
Makoto
  • 106.2k
  • 120
  • 864
  • 1.3k
Loading
Source Link
Richard
  • 60.7k
  • 14
  • 9
Loading