Docusaurus: Markdown relative image paths

Created on 14 Jul 2020  路  5Comments  路  Source: facebook/docusaurus

馃悰 Bug Report

In /docs/myDoc.md

![text](./assets/image.png)

This should be able to display an image in "/docs/assets/image.png`


Potential solution:

  • MDX transpiles to <img src="./assets/image.png"/>
  • we should find a way to make it transpile to <img src={require("./assets/image.png").default}/>

Note, this kind of trick probably exist in Gatsby codebase, so it's worth taking a look

bug mlh v2

Most helpful comment

I fixed it and created a PR

All 5 comments

we can create a remark plugin for it and convert it to jsx before going to MDX.

yes if you can try to create a poc that would be cool :) I'm not very familiar with remark/rehype

ok i will create a POC.

I have created the poc but I need some help with webpack. I used url-loader in require to load image but it creates a wired base64 with export default embedded in base65 string

I fixed it and created a PR

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itelofilho picture itelofilho  路  3Comments

ericnakagawa picture ericnakagawa  路  3Comments

chandankumar4 picture chandankumar4  路  3Comments

JoelMarcey picture JoelMarcey  路  3Comments

MoogyG picture MoogyG  路  3Comments