2

I'm trying to add a language hint to a snippet in a list item like so:

- A list with code:

  <!-- language: lang-none -->

      some code

  with follow-up...
- Another item

In the Meta preview, it renders as expected:

enter image description here

Here is it live:

  • A list with code:

    some code
    

    with follow-up...

  • Another item

On StackOverflow and electronics.SE on the other hand, it breaks the list and renders as:

enter image description here

I posted (and deleted) a question on SO to ensure that it was following through with the formatting, and it does indeed seem to.

Why is this happening, and is there any reliable way to add language hint to a code block within a list?

  • Stack Exchange is switching to a different type of Markdown renderer, which has rolled out on Meta, but not on the other sites yet. Also, the HTML comment language hints won't work with the new renderer. For the full info, see We're switching to CommonMark. – Sonic the Masked Werehog Jun 6 at 22:30
4

Meta has switched to CommonMark. Fortunately all other sites will soon switch too and then everything will

  1. be consistent
  2. render as you expect

Note that language codes work differently in CommonMark so do read that question for how the new syntax works.

| improve this answer | |

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