This is messing with a program of mine as the link is basically causing a redirect to my page (I am coding in electron.js and react.js so reloading a page to a '/' is very bad.) and showing an unnecessary link.
Edit: even just doing [whatever] creates a blank link.
Its noted here that:
brackets that aren鈥檛 part of links do not take precedence
It's not a problem with react-markdown package, it's more on how markdown is parsed via remark-parse.
The fast workaround may be to create custom renderer for linkReference:
<ReactMarkdown
source={source}
renderers={{
linkReference: (reference) => {
if (!reference.href) {
return `[ ${reference.children[0]} ]`;
}
return <a href={reference.$ref}>{reference.children}</a>
}
}}/>
Im having the same issue. It works great locally but as soon as I deploy to aws-amplify there is an redirect causing it to not display the .md file....
Any insight?
Most helpful comment
It's not a problem with
react-markdownpackage, it's more on how markdown is parsed via remark-parse.The fast workaround may be to create custom renderer for
linkReference: