Markdown preview and result differ

Took a quick look out of curiosity. It looks like an issue with the Nokogiri library. :thinking:

From what uses Discourse here:

Loofah.fragment uses Nokogiri’s HTML4 parser.

This could be fixed using Loofah.html5_fragment as long as Nokogiri >= 1.14.0 and Loofah >= 2.21.0. Discourse already uses Nokogiri::HTML5.fragment; that would make sense.

Note: Loofah 2.21.0 is not yet released; currently in RC1.