# Markdown preview and result differ

**URL:** https://meta.discourse.org/t/markdown-preview-and-result-differ/263878
**Category:** Bug
**Tags:** composer
**Created:** [May 4, 2023, 8:05pm UTC](https://meta.discourse.org/t/markdown-preview-and-result-differ/263878 "2023-05-04T20:05:18Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [May 5, 2023, 1:28am UTC](https://meta.discourse.org/t/markdown-preview-and-result-differ/263878/4 "2023-05-05T01:28:59Z")

</div>

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

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/2/9/9296a72cfb6dd9cdd19916afd0ad6257a0732b5e.png)

From what uses Discourse here:

> <https://github.com/discourse/discourse/blob/7ff8e5580f9a900cde4be66377cf4f1dcd253a35/lib/pretty_text.rb#L314>

`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](https://github.com/flavorjones/loofah) is not yet released; currently in RC1.

---

_[View the full topic](https://meta.discourse.org/t/markdown-preview-and-result-differ/263878)._
