Syntax highlighting is not defaulting to python

Without explicit language declaration:

class EnumName([mixins...,] [data_type,] base_enum):

with explicit py syntax highlighting:

class EnumName([mixins...,] [data_type,] base_enum):

I guess the default is for the highlighter to guess a language? While not necessarily bad, IMO defaulting to python on this site would be better behavior.

This particular example was taken from Bad representation of expressions with "-" , but I have seen this a few times in the preview and added the language manually before posting.

For reference, this is what the preview looks like:

I’m pretty sure this has been brought up before…

if it has, I can’t find it by searching for syntax or highlighting in Discourse Feedback.

It was set to “auto”. I just set it to “python” (I thought we had done that previously; maybe got reset by accident?).


Seems to have worked, thank you. (The OP post apparently would need to be edited for the change to apply. Fair enough I guess)

As I mod I can also trigger Rebuild HTML, but ISTM its useful to keep it for posterity so accurately illustrates the problem it was intended to show.

1 Like