mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-13 13:54:56 +00:00
Convert image url to base64 #453
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fairking on GitHub (Apr 9, 2021).
Is there any option to tell Markdip instead of rendering the image with the url, include its base64.
I am building html on the server side. I am not sure if it's a good approach (no image caching etc.) but the client would not have an access to any md nor image files. So I'm thinking whether it's possible that Markdig can translate images with urls to the base64 representation. I am not expecting a huge image file sizes (up to 5Kb).
Eg.:
index.md:index.html:Very appreciate any help. Thanks.
@fairking commented on GitHub (Apr 9, 2021):
By the way I know I can do that manually by replacing all images with it's base64 after the html convertion. But wondering if there some option already exists.
@MihaZupan commented on GitHub (Apr 9, 2021):
This doesn't exist in Markdig as it's out of scope (external IO).
You can do the conversion yourself, something like:
@fairking commented on GitHub (Apr 12, 2021):
Thanks a lot for a very smart solution. Bellow you can find a
GetBase64ImageAsync(link.Url)for those who needs it: