Strangely ordered markdown + HTML is shown differently in post vs. preview

**<big>This is a test:** End test.</big>

Preview shows (image):
image

Actually shows (image for historical reference):
image

Actually shows (text):
This is a test: End test.


Changing it to

<big>**This is a test:** End test.</big>

as I’d meant to do shows it correctly and consistently. I’m not sure what the expected behavior of the strangely ordered markdown + HTML should be, but it should at least be consistent between the preview and the actual post.

Inconsistent ordering of tags is not supported in any markup engine, and will always produce unknown and generally bad results.

2 Likes

Okay. So I’m curious then, what does the preview and post rendering do differently that can cause inconsistencies?

This is well documented all over the internet, for example Nesting Tags : TechWeb : Boston University

I was referring specifically to Discourse’s rendering engine. I get that it’s not supported to use misordered tags. I was just curious if, for example, there are two separate implementations, whether the algorithm is nondeterministic, etc.

There are differences in markup between the preview and topics. Most of them are related to some content being added on the server side (like one boxes), but others are as simple as where it is in the DOM. The composer has a different HTML structure than the posts view, and that’s enough to make a difference in unsupported behaviour like this.

3 Likes