# Markdown rendering issue with image surrounded with HTML

**URL:** https://meta.discourse.org/t/markdown-rendering-issue-with-image-surrounded-with-html/152801
**Category:** Bug
**Created:** [May 26, 2020, 5:21pm UTC](https://meta.discourse.org/t/markdown-rendering-issue-with-image-surrounded-with-html/152801 "2020-05-26T17:21:21Z")
**Posts on this page:** 1
**Showing post:** 25

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [August 11, 2021, 2:19am UTC](https://meta.discourse.org/t/markdown-rendering-issue-with-image-surrounded-with-html/152801/25 "2021-08-11T02:19:42Z")

</div>

This issue has cropped up again

> [@Run-together markdown formatting mixed with html makes images not load](https://meta.discourse.org/t/run-together-markdown-formatting-mixed-with-html-makes-images-not-load/199445/11):
>
> I see, thanks for clarifying. Honestly, this is unlikely to change anytime soon for the [reasons discussed in the topic I linked above](https://meta.discourse.org/t/markdown-rendering-issue-with-image-surrounded-with-html/152801/13). For example The key thing for us is to maintain the integrity of the content, so the newline solution will probably not happen. The problem is that if you were to try and autocorrect for the issue you’re describing it would potentially create other issues. The current solution here is to add your wordpress domain to the disabled image download domains site se…

Just thinking out-loud here, but I wonder if we can elide the tricky problem here (i.e. the conversion of HTML to markdown). To recap (just to help think this through)

1. Discourse supports the importation of HTML for the creation of post content (e.g. HTML from [WP Discourse](https://github.com/discourse/wp-discourse)).

2. In some contexts the user expects the integrity of the original HTML to be retained exactly.

3. “integrity” here has at least two aspects:

4. The conversion of HTML to markdown potentially creates issues for the first type of integrity, however it is currently necessary to ensure the second type of integrity.

So perhaps one way to address this issue for certain imported posts would be for the imported HTML to be stored directly as the cooked post content, and the `pull_hotlinked_images` job would support downloading images in such content without converting `img` to markdown.

Yes, put more simply, perhaps the code could support downloading hotlinked images without requiring a conversion of the `img` to markdown. For such posts you would [interpolate the downloaded image url in the cooked content instead of the raw](https://github.com/discourse/discourse/blob/main/app/jobs/regular/pull_hotlinked_images.rb#L53).

---

_[View the full topic](https://meta.discourse.org/t/markdown-rendering-issue-with-image-surrounded-with-html/152801)._
