Reputation: 45
I am rendering some markdown text containing image tags like the following
![Jasper](/path/to/photos/here/jasper.jpg)
using the Remark-Rehype libraries. However I want to dynamically replace the /path/to/photos/here/jasper.jpg
with the Base64 obtained from a cache originally retrieved from a document database, like:
<img src="data:image/jpg;base64,UEhOMlp5....." alt="Jasper"/>
All of this is working, except that Rehype is blanking out the img's src contents src=""
.
I have found one other question asked about this here:
Can I allow inline images in markdown files when using remark-rehype?
but the accepted answer doesn't give any examples except use rehype-raw. When I look into that it defers the answer to hast-util-raw, which defers the answer again to mdast-util-to-hast which doesn't seem to provide an example.
Does anyone know how to pass the passThrough
options to remark-raw so that we can avoid having the <img src="" />
attribute from being stripped?
Upvotes: 0
Views: 50