Using a Data URI as an image source doesn't work #129

Closed
opened 2026-01-29 14:28:11 +00:00 by claunia · 2 comments
Owner

Originally created by @JeroenVogelpoel on GitHub (Aug 2, 2017).

As shown here, Markdig does not render an image with a data URI as an actual image.

The expected output is an IMG tag with the SRC attribute set to the non-URI contents given in the example and an ALT text of 'hello'.

Would it be possible and realistic that the support of data URIs for images can be enabled in Markdig?

Thanks in advance!

Originally created by @JeroenVogelpoel on GitHub (Aug 2, 2017). As shown [here](https://babelmark.github.io/?text=!%5Bhello%5D(data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAA%0AANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4%0A%2F%2F8%2Fw38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU%0A5ErkJggg%3D%3D)), Markdig does not render an image with a data URI as an actual image. The expected output is an IMG tag with the SRC attribute set to the non-URI contents given in the example and an ALT text of 'hello'. Would it be possible and realistic that the support of data URIs for images can be enabled in Markdig? Thanks in advance!
claunia added the wontfix label 2026-01-29 14:28:12 +00:00
Author
Owner

@xoofx commented on GitHub (Aug 2, 2017):

The problem is that CommonMark specs are not allowing any spaces/linebreaks in the URL. If you remove spaces from your data url, it will just work. So I'm afraid that this cannot be supported.

@xoofx commented on GitHub (Aug 2, 2017): The problem is that CommonMark specs are not allowing any spaces/linebreaks in the URL. If you remove spaces from your data url, it will just work. So I'm afraid that this cannot be supported.
Author
Owner

@JeroenVogelpoel commented on GitHub (Aug 3, 2017):

Yep, removing the whitespace seems to fix it.

Works good for me, thanks!

@JeroenVogelpoel commented on GitHub (Aug 3, 2017): Yep, [removing the whitespace](https://babelmark.github.io/?text=!%5Bhello%5D(data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4%2F%2F8%2Fw38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg%3D%3D)) seems to fix it. Works good for me, thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#129