bot icon indicating copy to clipboard operation
bot copied to clipboard

Wonky syntax highlighting

Open jahrules opened this issue 3 years ago • 2 comments

Noticed today that Python is highlighting some syntax that it shouldn't be:

Screenshot_20220816-145138

jahrules avatar Aug 16 '22 18:08 jahrules

The syntax highlighting is done by Discord, rather than this bot.

It is also platform specific, with some platforms behaving weirdly as you describe. For example, here is what it looks like on my Windows machine: image

Unfortunately, there isn't anything we can do ourselves, other than remove the syntax highlighting entirely, which we don't want to do.

ChrisLovering avatar Aug 16 '22 18:08 ChrisLovering

One possibility would be trying to work out the syntax highlighting based on whatever is being used on the actual doc page. Taking a quick look I can't see a way that woud actually be done, that information seems to be lost by the time the doc page is actually rendered.

Another idea would be to try parsing the contents of the codeblock, and see if it parses as valid python, like how we do already to detect people sending code without codeblocks https://github.com/python-discord/bot/blob/main/bot/exts/info/codeblock/_parsing.py.

Either way this seems like it would take quite a bit of effort to solve, i'm not convinced it would be worth it.

wookie184 avatar Aug 17 '22 09:08 wookie184

I don't think this is enough of an issue to be worth fixing.

wookie184 avatar Apr 14 '24 16:04 wookie184