The easiest way is to say that I love how Microsoft Teams does this:
(from MS Teams, you can select the Font button, and then do the following:

The code snippet looks like this, if you put something in it:

Of course, we don't even need the example button, the separate is just great to parse it from other things in the text with easy formatting:

Of course, using "Quote" in teams does something that would work great too, making code easy to read (or ignore) while you're trying to read comments instead of the actual code:

This copies and pastes into SWSD well, although once you submit it, it removes the awesome formatting:
(comment below is in an incident in SWSD):

See how I can easily see the script but can read the comments before even digging into the code. This is a lot more useful when there is a long script or log you're putting in the comment.
If I submit the comment above, it does this:

Sure, I can highlight all of the text and color code it, although the longer it is, the harder it is to keep it clean. This takes a lot of time.