We've found this problem in this question on Stack Overflow in Portuguese, but I've also tested in other sites (English and Spanish SO's), and it happened there as well.

In the aforementioned question, there's a code block, with the following markdown:

               FILHO 1
FILHO 2  |  FILHO 7    |   FILHO 12
FILHO 3  |  FILHO 8    |   FILHO 13
FILHO 4  |  FILHO 9    |   FILHO 14
FILHO 5  |  FILHO 10   |   FILHO 15
FILHO 6  |  FILHO 11   |   FILHO 16

But the page is being rendered as:

some parts of codeblock are formatted

Please note that some parts of the code are bold: the line FILHO1 and the line starting with FILHO 6 (and the lines with hyphens that come right after them).

It happens on both questions and answers, and it's happening also in the preview, but not all the time.

Doing some tests, I could reproduce the problem only when there are at least two language tags in the question, as the gif below shows (that's the preview in Ask a Question page, on SOpt, the markdown is exactly the same as above):

two language tags seems to trigger the bug

The presence of two language tags seems to be what causes the problem. When there are other non-language tags, they don't seem to affect the rendering.

Note: I also suspect that it might be related to the language hint (in the block above, it's text, which I believe it's an invalid one). If I don't use any language hint, the problem also happens, but if I use a valid language hint (such as ```java, then the problem doesn't happen).

This gif was made on SOpt, in the Ask a Question page. But it also happens if I'm answering a question with at least two language tags (tested on SOpt, SOen and SOes - I've checked only the preview, because I didn't want to pollute the sites with "test-answers"). I also couldn't find other questions with these specific characteristics (two language tags and a similar code block), but I'd appreciate any help finding those.


1 Answer 1


It's being interpreted as a "markdown" language code block, where a line of hyphens makes the preceding line a h1 (or h2, can't remember which). Set the language to lang-none like below:

  • I've checked that the problem doesn't occur if I use any valid language hint (not only lang-none - I have updated the question with this info). Anyway, I still believe this should be fixed, as it makes no sense to interpret code blocks as markdown.
    – hkotsubo
    Commented Jun 1, 2021 at 12:18
  • 5
    @hkotsubo “Anyway, I still believe this should be fixed, as it makes no sense to interpret code blocks as markdown” — Why? Markdown is code. Commented Jun 1, 2021 at 12:27
  • @SebastianSimon If I put anything inside a code block, I expect it to be rendered as the code itself, not to have any formatting (such as bold) applied to the text (if I wanted that, I wouldn't use a code block)
    – hkotsubo
    Commented Jun 1, 2021 at 12:30
  • 4
    @hkotsubo The bold and larger font size is just valid highlighting of Markdown code. I don’t really see anything wrong with that. Commented Jun 1, 2021 at 12:41
  • 3
    @hkotsubo It is rendered as the code itself. This is a code block with syntax highlighting for code in a certain language, and as it happens, that language is being autodetected as Markdown here. This is not Markdown formatting, but syntax highlighting for Markdown code. Commented Jun 1, 2021 at 13:52
  • @EmilJeřábek I admit I was completely unaware of that (as I've never used markdown as a language in code blocks). Therefore, the only problem here seems to be the language detection algorithm, so I guess my question is a dup of the links already pointed by Sebastian. Is that it?
    – hkotsubo
    Commented Jun 1, 2021 at 14:13
  • @EmilJeřábek I thought the syntax highlighting would be applied according to the question tags if none is specified. So if a question is tagged as html and css (as in the gif above), it still analyzes for any syntax highlight? Commented Jun 1, 2021 at 16:04
  • 4
    @RafaelTavares Please, see the links posted above in the comments, in particular meta.stackexchange.com/questions/354793/…. If there is exactly one language tag on the question, it gets passed to the highlighter as a hint and all is well, but if there are more tags, then none is passed, and the highlighter has to do autodetection with no information. This behaviour is, arguably, a bug on the part of SE. Commented Jun 1, 2021 at 16:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .