Markdown rendering issue with image surrounded with HTML

Unformatted
<div data-wp><a href="https://www.mooki.co.il/gaming/hbilvt-giiming-mwtlmvt/mvwb-giiming-khvl-sparkfox-wvlhn-giiming-mqcvei-lumi-whvr-2" target="_blank">![](upload://vAPxoqZB2QvWCrX4kbbzSO5BYYb.png)</a><div><div data-buy><a href="https://www.mooki.co.il/gaming/hbilvt-giiming-mwtlmvt/mvwb-giiming-khvl-sparkfox-wvlhn-giiming-mqcvei-lumi-whvr-2" target="_blank">ืงื ื™ื™ื”</a><span data-clipboard-text="GLA679" data-coupon>GLA679</span><i></i></div><div data-price>โ‚ช679 <span data-old-price>โ‚ช1378</span></div></div></div><hr /><p><small>&nbsp;ืคื•ืจืกื ื‘:&nbsp;<a href="https://zuzu.deals/%d7%91%d7%9c%d7%a2%d7%93%d7%99-%d7%95%d7%91%d7%9e%d7%97%d7%99%d7%a8-%d7%97%d7%98%d7%99%d7%a4%d7%94-%d7%9e%d7%95%d7%a9%d7%91-%d7%92%d7%99%d7%99%d7%9e%d7%99%d7%a0%d7%92-%d7%90%d7%93%d7%95%d7%9d-spark/"></a></small></p><br><p>![](upload://npQfkOhEIdPiFymVdtVyKmwRShL.png)</p>
<p style="text-align: center;">ื‘ื™ืŸ ืื ืืชื ื’ื™ื™ืžืจื™ื ื•ื‘ื™ืŸ ืื ืืชื ืคืฉื•ื˜ ืขื•ื‘ื“ื™ื ื•ื™ื•ืฉื‘ื™ื ื›ืœ ื”ื™ื•ื ื•ื”ื’ื‘ ื›ื‘ืจ ื–ื•ืขืง ืœื›ื™ืกื ื˜ื•ื‘ ื™ื•ืชืจ, ื”ื ื” ืœื›ื ืขื•ื“ ืžื‘ืฆืข ื‘ืœืขื“ื™ ื‘ืžื—ื™ืจ ื—ื˜ื™ืคื”!<br />
ื›ื™ืกื ื’ื™ื™ืžื™ื ื’ ืžืคื ืง, ืื•ื–ื ื™ื•ืช ื’ื™ื™ืžื™ื ื’ ื•ืžืฉืœื•ื— ืžื”ื™ืจ ื‘ื—ื™ื ื, ืขื ืื—ืจื™ื•ืช ื™ื‘ื•ืืŸ ืจืฉืžื™ &#8211; ืจืง ื‘679โ‚ช!!!</p>
<p style="text-align: center;">ื”ืฉืชืžืฉื• ื‘ืงื•ืคื” ื‘ืงื•ืคื•ืŸ ื”ื‘ืœืขื“ื™ &#8211; <strong>GLA679</strong></p>
<div> ![](upload://3c2tvGxZnMqoIn2fVfHA02wocm.jpeg)</div>
<div>
<h3 style="text-align: center;">ืžื•ืฉื‘ ื’ื™ื™ืžื™ื ื’ ืžืงืฆื•ืขื™ SPARKFOX GC60P</h3>
</div>
<div>ืžื•ืฉื‘ ื’ื™ื™ืžื™ื ื’ ื‘ืขืœ ืขื™ืฆื•ื‘ ืžื™ื•ื—ื“ ืœืžืฉื—ืงื™ ืžื—ืฉื‘ ืœื ื•ื—ื•ืช ืžืงืกื™ืžืืœื™ืช ืœืžืฉืชืžืฉ</div>
<div>
<ul>
<li>ืžื•ืฉื‘ ื‘ืขืœ ืžืฉืขื ืช ื’ื‘ ื’ื‘ื•ื”ื”</li>
<li>ื ื•ื—ื•ืช ื”ืžืงืกื™ืžืืœื™ืช ืœืžืฉืš ื–ืžืŸ ืžืฉื—ืง ืืจื•ืš</li>
<li>ื–ื•ื’ ื›ืจื™ื•ืช ืœืชืžื™ื›ื” ื‘ืฆื•ื•ืืจ ื•ื‘ื’ื‘ ื”ืชื—ืชื•ืŸ</li>
<li>ืกื•ื’ ื—ื•ืžืจ: ืกืคื•ื’ ื™ืฆื•ืง</li>
<li>ืกื•ื’ ืžืกื’ืจืช: ืžืชื›ืช</li>
<li>ื—ื•ืžืจ: ืขื•ืจ ืขื ืกื™ื‘ื™ ืคื—ื</li>
<li>ืžืฉืขื ื•ืช ื™ื“ื™ื™ื: ืžืชื›ื•ื•ื ื ื•ืช ืžืขืœื” / ืžื˜ื”</li>
<li>ืกื•ื’ ืžื ื’ื ื•ืŸ: ืคืจืคืจ</li>
<li>ืกื•ื’ ื”ืจืžื”: ื”ื™ื“ืจืื•ืœื™ืช Class4</li>
<li>ื˜ื•ื•ื— ืžืฉืขื ืช ื’ื‘: 90ยฐ-180ยฐ</li>
<li>ืกื•ื’ ื‘ืกื™ืก: ื ื™ื™ืœื•ืŸ</li>
<li>ื—ื•ืžืจ ื’ืœื’ืœ: ื ื™ื™ืœื•ืŸ</li>
<li>ื™ื›ื•ืœืช ื ืฉื™ืื”: ืขื“ 150 ืงโ€ื’</li>
<li>ืื—ืจื™ื•ืช: ืฉื ื”</li>
</ul>
<div><strong>ืžื™ื“ื•ืช</strong></div>
<div>
<ul>
<li>ืจื•ื—ื‘: 67 ืก&quot;ืž</li>
<li>ืขื•ืžืง: 67 ืก&quot;ืž</li>
<li>ื’ื•ื‘ื” ืžืฉืชื ื”: 124-132 ืก&quot;ืž</li>
</ul>
<h3></h3>
<p>![](upload://7t26ZtW6tL3vobWYqbpCbRftvpV.jpeg)</p>
<h3 style="text-align: center;">ืื•ื–ื ื™ื•ืช ื’ื™ื™ืžื™ื ื’ SPARKFOX K1</h3>
<div>ืื•ื–ื ื™ื•ืช ื’ื™ื™ืžื™ื ื’ ื‘ืขื™ืฆื•ื‘ ืžื™ื•ื—ื“ ืœื ื•ื—ื•ืช ืžืงืกื™ืžืœื™ืช ืœืฉืžืข ื•ื“ื™ื‘ื•ืจ ื•ื‘ื™ื˜ื•ืœ ืจืขืฉื™ ืจืงืข</div>
<div>
<ul>
<li>ื ื™ืชื ื•ืช ืœืฉื™ืžื•ืฉ ื‘ืจื•ื‘ ื”ืงื•ื ืกื•ืœื•ืช ื”ืงื™ื™ืžื•ืช ื‘ืฉื•ืง</li>
<li>ืฉืžืข ื•ื ื™ื”ื•ืœ ืฉื™ื—ื•ืช ื‘ื˜ืœืคื•ื ื™ื ื•ื‘ืžื—ืฉื‘ื™ื ื ื™ื™ื“ื™ื</li>
<li>ื•ื•ืกืช ืขื•ืฆืžืช ื”ืฉืžืข ื”ื™ื ื• ื‘ื›ื‘ืœ ืฉืœ ื”ืื•ื–ื ื™ื™ื”- ืœื’ื™ืฉื” ื ื•ื—ื”</li>
<li>ืฉืžืข ืžืขื•ืœื” ืžืžื ื”ืœื™ ื”ืชืงื ื™ื ื’ื“ื•ืœื™ื ืฉืœ 50 ืž&quot;ืž</li>
<li>ื‘ืงืจื™ ืขื•ืฆืžืช ื”ืงื•ืœ ื•ื”ื”ืฉืชืงื”</li>
<li>ื›ื•ืกื•ืช ืื•ื–ื ื™ื™ื ืžืจื•ืคื“ื•ืช ื’ื“ื•ืœื•ืช ืœื ื•ื—ื•ืช ืžืจื‘ื™ืช</li>
<li>ืงืฉืช ื”ืื•ื–ื ื™ื™ื” ืžืชื›ื•ื•ื ื ืช ืœื”ืชืืžื” ืžื•ืฉืœืžืช ืœืจืืฉื›ื</li>
<li>ืžืชื—ื‘ืจ ื™ืฉื™ืจื•ืช ืœื™ืฆื™ืืช ื‘ืงืจื™ 3.5 ืž&quot;ืž</li>
</ul>
</div>
<div>ืžืฆื•ืจืฃ ืžืชืื ืžื™ื•ื—ื“ ืœื—ื™ื‘ื•ืจ ื”ืื•ื–ื ื™ื•ืช ืœืžื—ืฉื‘ ื ื™ื™ื— ืข&quot;ื™ ืžืคืฆืœ 3.5 ืž&quot;ืž ืœ 2 ื™ืฆื™ืื•ืช 3.5 ืž&quot;ืž</div>
</div>
</div>
<p>&nbsp;</p>
<div data-custom-html=""></div>
Formatted
<div data-wp>
    <a href="https://www.mooki.co.il/gaming/hbilvt-giiming-mwtlmvt/mvwb-giiming-khvl-sparkfox-wvlhn-giiming-mqcvei-lumi-whvr-2" target="_blank">![](upload://vAPxoqZB2QvWCrX4kbbzSO5BYYb.png)</a>
    <div>
        <div data-buy>
            <a href="https://www.mooki.co.il/gaming/hbilvt-giiming-mwtlmvt/mvwb-giiming-khvl-sparkfox-wvlhn-giiming-mqcvei-lumi-whvr-2" target="_blank">ืงื ื™ื™ื”</a
            ><span data-clipboard-text="GLA679" data-coupon>GLA679</span><i></i>
        </div>
        <div data-price>โ‚ช679 <span data-old-price>โ‚ช1378</span></div>
    </div>
</div>
<hr />
<p>
    <small
        >&nbsp;ืคื•ืจืกื ื‘:&nbsp;<a href="https://zuzu.deals/%d7%91%d7%9c%d7%a2%d7%93%d7%99-%d7%95%d7%91%d7%9e%d7%97%d7%99%d7%a8-%d7%97%d7%98%d7%99%d7%a4%d7%94-%d7%9e%d7%95%d7%a9%d7%91-%d7%92%d7%99%d7%99%d7%9e%d7%99%d7%a0%d7%92-%d7%90%d7%93%d7%95%d7%9d-spark/"></a
    ></small>
</p>
<br />
<p>![](upload://npQfkOhEIdPiFymVdtVyKmwRShL.png)</p>
<p style="text-align: center;">
    ื‘ื™ืŸ ืื ืืชื ื’ื™ื™ืžืจื™ื ื•ื‘ื™ืŸ ืื ืืชื ืคืฉื•ื˜ ืขื•ื‘ื“ื™ื ื•ื™ื•ืฉื‘ื™ื ื›ืœ ื”ื™ื•ื ื•ื”ื’ื‘ ื›ื‘ืจ ื–ื•ืขืง ืœื›ื™ืกื ื˜ื•ื‘ ื™ื•ืชืจ, ื”ื ื” ืœื›ื ืขื•ื“ ืžื‘ืฆืข ื‘ืœืขื“ื™ ื‘ืžื—ื™ืจ ื—ื˜ื™ืคื”!<br />
    ื›ื™ืกื ื’ื™ื™ืžื™ื ื’ ืžืคื ืง, ืื•ื–ื ื™ื•ืช ื’ื™ื™ืžื™ื ื’ ื•ืžืฉืœื•ื— ืžื”ื™ืจ ื‘ื—ื™ื ื, ืขื ืื—ืจื™ื•ืช ื™ื‘ื•ืืŸ ืจืฉืžื™ &#8211; ืจืง ื‘679โ‚ช!!!
</p>
<p style="text-align: center;">ื”ืฉืชืžืฉื• ื‘ืงื•ืคื” ื‘ืงื•ืคื•ืŸ ื”ื‘ืœืขื“ื™ &#8211; <strong>GLA679</strong></p>
<div>![](upload://3c2tvGxZnMqoIn2fVfHA02wocm.jpeg)</div>
<div>
    <h3 style="text-align: center;">ืžื•ืฉื‘ ื’ื™ื™ืžื™ื ื’ ืžืงืฆื•ืขื™ SPARKFOX GC60P</h3>
</div>
<div>ืžื•ืฉื‘ ื’ื™ื™ืžื™ื ื’ ื‘ืขืœ ืขื™ืฆื•ื‘ ืžื™ื•ื—ื“ ืœืžืฉื—ืงื™ ืžื—ืฉื‘ ืœื ื•ื—ื•ืช ืžืงืกื™ืžืืœื™ืช ืœืžืฉืชืžืฉ</div>
<div>
    <ul>
        <li>ืžื•ืฉื‘ ื‘ืขืœ ืžืฉืขื ืช ื’ื‘ ื’ื‘ื•ื”ื”</li>
        <li>ื ื•ื—ื•ืช ื”ืžืงืกื™ืžืืœื™ืช ืœืžืฉืš ื–ืžืŸ ืžืฉื—ืง ืืจื•ืš</li>
        <li>ื–ื•ื’ ื›ืจื™ื•ืช ืœืชืžื™ื›ื” ื‘ืฆื•ื•ืืจ ื•ื‘ื’ื‘ ื”ืชื—ืชื•ืŸ</li>
        <li>ืกื•ื’ ื—ื•ืžืจ: ืกืคื•ื’ ื™ืฆื•ืง</li>
        <li>ืกื•ื’ ืžืกื’ืจืช: ืžืชื›ืช</li>
        <li>ื—ื•ืžืจ: ืขื•ืจ ืขื ืกื™ื‘ื™ ืคื—ื</li>
        <li>ืžืฉืขื ื•ืช ื™ื“ื™ื™ื: ืžืชื›ื•ื•ื ื ื•ืช ืžืขืœื” / ืžื˜ื”</li>
        <li>ืกื•ื’ ืžื ื’ื ื•ืŸ: ืคืจืคืจ</li>
        <li>ืกื•ื’ ื”ืจืžื”: ื”ื™ื“ืจืื•ืœื™ืช Class4</li>
        <li>ื˜ื•ื•ื— ืžืฉืขื ืช ื’ื‘: 90ยฐ-180ยฐ</li>
        <li>ืกื•ื’ ื‘ืกื™ืก: ื ื™ื™ืœื•ืŸ</li>
        <li>ื—ื•ืžืจ ื’ืœื’ืœ: ื ื™ื™ืœื•ืŸ</li>
        <li>ื™ื›ื•ืœืช ื ืฉื™ืื”: ืขื“ 150 ืงโ€ื’</li>
        <li>ืื—ืจื™ื•ืช: ืฉื ื”</li>
    </ul>
    <div><strong>ืžื™ื“ื•ืช</strong></div>
    <div>
        <ul>
            <li>ืจื•ื—ื‘: 67 ืก&quot;ืž</li>
            <li>ืขื•ืžืง: 67 ืก&quot;ืž</li>
            <li>ื’ื•ื‘ื” ืžืฉืชื ื”: 124-132 ืก&quot;ืž</li>
        </ul>
        <h3></h3>
        <p>![](upload://7t26ZtW6tL3vobWYqbpCbRftvpV.jpeg)</p>
        <h3 style="text-align: center;">ืื•ื–ื ื™ื•ืช ื’ื™ื™ืžื™ื ื’ SPARKFOX K1</h3>
        <div>ืื•ื–ื ื™ื•ืช ื’ื™ื™ืžื™ื ื’ ื‘ืขื™ืฆื•ื‘ ืžื™ื•ื—ื“ ืœื ื•ื—ื•ืช ืžืงืกื™ืžืœื™ืช ืœืฉืžืข ื•ื“ื™ื‘ื•ืจ ื•ื‘ื™ื˜ื•ืœ ืจืขืฉื™ ืจืงืข</div>
        <div>
            <ul>
                <li>ื ื™ืชื ื•ืช ืœืฉื™ืžื•ืฉ ื‘ืจื•ื‘ ื”ืงื•ื ืกื•ืœื•ืช ื”ืงื™ื™ืžื•ืช ื‘ืฉื•ืง</li>
                <li>ืฉืžืข ื•ื ื™ื”ื•ืœ ืฉื™ื—ื•ืช ื‘ื˜ืœืคื•ื ื™ื ื•ื‘ืžื—ืฉื‘ื™ื ื ื™ื™ื“ื™ื</li>
                <li>ื•ื•ืกืช ืขื•ืฆืžืช ื”ืฉืžืข ื”ื™ื ื• ื‘ื›ื‘ืœ ืฉืœ ื”ืื•ื–ื ื™ื™ื”- ืœื’ื™ืฉื” ื ื•ื—ื”</li>
                <li>ืฉืžืข ืžืขื•ืœื” ืžืžื ื”ืœื™ ื”ืชืงื ื™ื ื’ื“ื•ืœื™ื ืฉืœ 50 ืž&quot;ืž</li>
                <li>ื‘ืงืจื™ ืขื•ืฆืžืช ื”ืงื•ืœ ื•ื”ื”ืฉืชืงื”</li>
                <li>ื›ื•ืกื•ืช ืื•ื–ื ื™ื™ื ืžืจื•ืคื“ื•ืช ื’ื“ื•ืœื•ืช ืœื ื•ื—ื•ืช ืžืจื‘ื™ืช</li>
                <li>ืงืฉืช ื”ืื•ื–ื ื™ื™ื” ืžืชื›ื•ื•ื ื ืช ืœื”ืชืืžื” ืžื•ืฉืœืžืช ืœืจืืฉื›ื</li>
                <li>ืžืชื—ื‘ืจ ื™ืฉื™ืจื•ืช ืœื™ืฆื™ืืช ื‘ืงืจื™ 3.5 ืž&quot;ืž</li>
            </ul>
        </div>
        <div>ืžืฆื•ืจืฃ ืžืชืื ืžื™ื•ื—ื“ ืœื—ื™ื‘ื•ืจ ื”ืื•ื–ื ื™ื•ืช ืœืžื—ืฉื‘ ื ื™ื™ื— ืข&quot;ื™ ืžืคืฆืœ 3.5 ืž&quot;ืž ืœ 2 ื™ืฆื™ืื•ืช 3.5 ืž&quot;ืž</div>
    </div>
</div>
<p>&nbsp;</p>
<div data-custom-html=""></div>
Screenshot of composer

1 Like

This is the same issue as is brought up here: Images not publishing to Discourse in WP 5.3

3 Likes

Aha! @simon will upgrading the wordpress plugin fix old posts? Or only new posts?

3 Likes

The fix only applies to posts that are published with the WordPress Block editor. It will fix old posts if the โ€œUpdate Discourse Topicโ€ button is clicked on WordPress. It will need to be done manually for each post unless someone writes a script to loop through old posts.

4 Likes

Letโ€™s try this HTML:

<p><img src="..."/></p>

![](upload://6zqK52dO23i1JsYH2oyMU12U2ro.jpeg)

4 Likes

I think this should be fixed in Discourse as well, just in case posts are made by a non-wordpress integration. To summarise:

  1. I posted <p><img src="..."/></p>. This is perfectly valid HTML

  2. pull_hotlinked_images fetched the image, and replaced the markup with <p>![](upload://6zqK52dO23i1JsYH2oyMU12U2ro.jpeg)</p>

  3. This does not render

So there are two possible fixes here. Either:

  • We fix InlineUploads so that it adds a blank line in the markup. This renders fine:
    <p>
    
    ![](upload://6zqK52dO23i1JsYH2oyMU12U2ro.jpeg)
    </p>
    

OR

@sam do you know if thereโ€™s a deliberate reason that markdown images wonโ€™t render on the same line as a <p>?

3 Likes

This is part of the CommonMark spec

**test**

<p>**test**</p>

Absolutely do not want to deviate from the spec here. I guess we fix pull hotlink images to allow for this by injecting 2 newlines for cases like this. I think it is rather rare though and sort of self inflicted.

5 Likes

I donโ€™t think itโ€™s that rare, especially when Discourse is associated to popular tools such as WP-Discourse or any tools which uses the API.

Please consider to add a blank line. It does not seems that would be a breaking change and fairly easy to implement. :pray:

2 Likes

@Arkshine we have been discussing this a lot internally. The key thing for us is to maintain the integrity of the content, so the newline solution will probably not happen.

But we will definitely be doing something - having the pull_hotlinked_images job destroy the images is not acceptable. Hope to have a solution soon :eyes:

5 Likes

A workaround for this issue is to prevent Discourse from downloading the remote images. This can be done by adding the image domain to the disabled image download domains site setting. It is also possible to prevent Discourse from downloading all remote images by disabling the download remote images to local site setting. See Fix broken images for posts created by the WP Discourse and RSS plugins for details.

4 Likes

In our case, we canโ€™t because weโ€™re using the official topic thumbnail component which requires a local image. We solved the issue by adding newlines before any <img> in the content before topic being created with WP-Discourse. Not a solution for everyone but it works for us. A bit sad Discourse doesnโ€™t support this legal usage.

But yes, if you are not tightened to a plugin/component and/or canโ€™t fix the content before topic is created, this is for sure a reasonable workaround.

2 Likes

We are still planning to fix the issue. Unfortunately it is a problem quite deep in our markdown rendering system which is complex to fix. But we will get to it - sorry it is taking so long!

5 Likes

Iโ€™m just adding a note here that the issue affects posts with images that are created via the Discourse RSS plugin as well.

3 Likes

Sorry for the multiple posts in this topic, but the issue also affects images in posts that are created through our Zendesk plugin when the sync comments from zendesk setting is enabled. The difficulty with this case is that itโ€™s not possible to know the source of the images before hand, so the workaround of adding the image src to the disabled image download domains setting will not work.

Is there any way we could just prevent remote images from being downloaded to local if the image tag is wrapped in HTML tags?

I am afraid that is completely off the table, if we did something like this we would allow third parties to track usage on a forum by injecting a tracking gif. The download remote image thing is a part security feature.

Instead I think we need a โ€œsmarterโ€ system that works similar to the way @tgxworld built our image remappers a few years ago, one that works backwards from HTML and ensures stability of the change by re-cooking. Very complex change sadly.

3 Likes

This issue has cropped up again

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).

  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:

    1. How the content is rendered, e.g. linebreaks
    2. Where media is hosted, e.g. downloading images to local to avoid broken images, or potentially for security concerns
  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.

2 Likes

The tricky thing is, how would you ever edit posts with that flag. The editor would be in raw html mode and the entire toolbar would be broken, etc.

Yes, if you went fully in that direction youโ€™d have to trade off not being able to edit content in Discourse with complete HTML integrity.

I was thinking there may be some middle ground where you just apply this approach to img tags in imported HTML posts.

But Iโ€™m second-guessing myself now. Doing this selectively would require changes in many parts of post processing.

1 Like

Yeah, I think this is probably the best option. I did make a start on it back in June 2020, but it ended up being a lot of work, and I had to move on to other projects. I had a couple of approaches to allowing upload:// URLs in <img tagsโ€ฆ neither is perfect. From my notes:


Implementation 1:

In the markdown pipeline, parse the content of each html_block (by slightly abusing the xss.js library), and process any image tags with upload:// src attributes.

Pros: all in the markdown pipeline, only does this processing on html_block tokens

Cons: kinda misusing the xss.js sanitizer. It might not be a perfect HTML5 parser

This option could be improved by using a standards-compliant javascript DOM implementation (e.g. jsdom) on the server, but that seems pretty heavyweight.

Implementation 2:

Allow upload:// src attributes all the way through the markdown pipeline, then replace them later. On the client, this is actually pretty simple - we were already replacing upload:// urls asynchronously after cooking. On the server, this does an extra processing step using Nokogiri.

Pros: parser is HTML5 standards compliant

Cons: different implementation on client/server, makes pipeline slightly more complex


I think option 2 is probably the way to go. Weโ€™ll then need to update the pull_hotlinked_images job to maintain <img tags, without replacing them with Markdown. I hope I can find time to get back to this soon :crossed_fingers:

3 Likes

Iโ€™m really not understanding the complication here. Clearly, the HTML image tag is being replaced with markdown โ€“ e.g. ![](upload://6zqK52dO23i1JsYH2oyMU12U2ro.jpeg). Why not just make that include two carriage returns before the ! ? Thatโ€™ll make it render right, and allow the image upload feature to work to prevent broken images and cross-site issues.

Is there a real-world non-theoretical situation where that whitespace might cause a problem? Is that problem worse than the โ€œimages are just broken all of the timeโ€ state of the current plugin?

@david, you note that โ€œthe newline solution will probably not happenโ€ because the โ€œkey thing for us is to maintain the integrity of the contentโ€. But the content is already changed by inserting the tags in the first place. Iโ€ฆ really donโ€™t get how this is possibly better.

Right now every time someone includes an image in their wordpress post, the images come back broken, and I am frequently having to deal with โ€œimages are brokenโ€ comments, now often followed by โ€œyes, itโ€™s bceause discourse sucksโ€ replies. I would like to avoid both of these things.

I understand that the โ€œdonโ€™t download imagesโ€ setting may be a workaround, but actually I do want images to be downloaded, so hopefully that can just be a temporary fix.