Emoji not displaying on lines with HTML

AI-generated summary

Users reported an issue where emojis and Markdown formatting fail to render correctly on lines containing HTML tags, even when the emoji appears outside the tag. tobiaseigen and sam confirmed this is a known CommonMark behavior — HTML blocks suspend Markdown parsing until the closing tag, which causes subsequent text (including emojis) to be treated as plain text. sam noted discrepancies with the markdown-it demo, suggesting a possible bug or outdated version. Later, david revealed the issue was caused by an experimental theme component on Meta affecting only the composer preview — once disabled, rendering worked as expected. The behavior of <h3>hi</h3> :smile: aligns with the CommonMark spec, though users found it unintuitive. The core issue was resolved by removing the faulty theme component, not by changing Markdown parsing rules.

image

It’s weird, but I’ve tried refreshing the page and creating new drafts.
Another odd thing I spotted was that when I would hit enter to create new lines in a post, it wouldn’t work, any text after the empty lines would show up on the same line as the text before them. The editor wasn’t like this several days ago, these issues didn’t occur.

Have you tried different browsers? In which one(s) is this occurring?

One thing I have noticed is that on lines that start with html, emojis and other markdown doesn’t work. If you look at the raw markdown for those posts you are having trouble with, do you see html?

E.g.

<p>This is an HTML paragraph with :eagle: emoji. 

Displays as:

This is an HTML paragraph with :eagle: emoji.

Whereas

This is not HTML with :eagle: emoji  

displays as:

This is not HTML with :eagle: emoji

Yeah this a a commonmark quirk and is working per spec:

<div>this is a *test* 
</div>
this is a *test*

I see..even if the emoji is outside of the html tag?

Oh something is not feeling right to me cause:

Is providing different results for:

<h1>test</h1> *test*

<h1>test</h1> :) 

(We eat *test* and :))

This is worth investigating, maybe it is fixed in a recent release or something.

@nbianca can you check if markdown.it needs updating? Why is the text after the close tag being eaten?

@nbianca identified that this was caused by an experimental theme component we had running on Meta, and only affected the composer preview.

I disabled it, and it works now:

<h1>test</h1> *test*

<h1>test</h1> :) 

test

*test*

test

:)

As for the original query, <h3>hi</h3> :smile: is rendering in line with the commonmark spec