Fenced code block is formatting part of it with italics

AI-generated summary

A bug was reported on Discourse 3.1.0.beta2 where part of a fenced code block was being formatted with italics. supermathie suggested the issue was due to the default code language formatting. The solution is to specify the language, in this case text, to prevent formatting.

| Left-aligned | Center-aligned | Right-aligned |
| :---         |     :---:      |          ---: |
| git status   | git status     | git status    |
| git diff     | git diff       | git diff      |

The original poster, rahim123, found this solution acceptable but suggested that monospaced font in code blocks should not be formatted apart from colors for the language. supermathie agreed that the issue was due to incorrect language detection and that using the correct language would improve the appearance.

Hi there, this bug is on Discourse 3.1.0.beta2 (def4133d59), and I also repeated the same bug on another Discourse forum that I don’t control. But for some reason it doesn’t happen here on Discourse Meta.

The following code block is formatting part of one line with italics:

| Left-aligned | Center-aligned | Right-aligned |
| :---         |     :---:      |          ---: |
| git status   | git status     | git status    |
| git diff     | git diff       | git diff      |

I’m using Firefox 102 ESR on Linux.

The blue “status” is the hint: it’s formatting with your default code language.

Here on meta it’s “text”.

You can fix this by specifying the language with:

```text

on the first fence.

Specifying it as the default “auto” I get:

| Left-aligned | Center-aligned | Right-aligned |
| :---         |     :---:      |          ---: |
| git status   | git status     | git status    |
| git diff     | git diff       | git diff      |

Ah, thanks a lot for explaining that. Changing the default to text looks like the best option for my forum.

However, I would still suggest that monospaced font in code blocks should never be formatted apart from the colors for the language.

It looks weird since the detected language was incorrect.

It would look much better with the right language!