When I have a markdown file with:
![[20230613_110437.jpg]]
in it, and I render it to html with
const html = marked.parse(content);
the html content just contains ![[20230613_110437.jpg]] rather than the image tag.
Also, the image urls should be prefixed with images/
, but I don’t see a way to configure that.
How do I configure marked to convert this to:
<img src="images/20230613_110437.jpg" />
2
Answers
marked.js
does not parse image syntax in Markdown files by default.To enable this feature, you can use the
renderer
option to customize the rendering of elements.Try this configuration to parse image syntax and prefix image URLs with images/:
I’m not sure if
![[20230613_110437.jpg]]
is an actual markdown. Why not just add images in the format of![]()
like:That renders to:
`