When converting all of @CompuIves' Medium posts over to @codesandbox' blog (see codesandbox/codesandbox-client#2011), I came across a bug when a link contains 2 underscores (_).
When I try to include the following Tweet-link, I just see the link with an italic d instead of the d between an underscore on both sides:
https://twitter.com/brian_d_vaughn/status/901488766581227520
I first thought it had something to do with @kentcdodds' remark-embed plugin, but it didn't.
After further investigation, I was able to reproduce it by taking the using-remark example and creating a file with just the link in it.
The user should see the correct link without an italic d that's inbetween 2 underscores (_).
https://twitter.com/brian_d_vaughn/status/901488766581227520
The user sees an incorrect link with an italic d that's not inbetween 2 underscores (_).
https://twitter.com/briandvaughn/status/901488766581227520
While I _can_ reproduce this, I'm not sure I would call this a bug. Looks like this is by design!
An easy work around would be to escape the underscore like https://twitter.com/brian\_d\_vaughn/status/901488766581227520
Okay, I did a little more digging. This behaviour is documented in remark as pedantic mode (https://github.com/remarkjs/remark/blob/master/packages/remark-parse/readme.md#optionspedantic)
From the README linked above
Emphasis (_alpha_) and importance (__bravo__) with underscores in words
gatsby-transformer-remark sets pedantic to true by default. Setting it to false in options should get rid of this behaviour (screenshot below).
{
resolve: `gatsby-transformer-remark`,
options: {
pedantic: false,
},
},

Closing this for now but feel free to reopen if there's anything else here that we can help with
@sidharthachatterjee Like you can see in @kentcdodds' comment (https://github.com/kentcdodds/kentcdodds.com/issues/191#issuecomment-499179350), this doesn't happen when using the RAW Markdown and passing it to the MDXRenderer.
Awesome you've looked deeper into this one @sidharthachatterjee! 馃憡
This looks likes it indeed fixes my problem, thanks! 馃檪
Most helpful comment
Okay, I did a little more digging. This behaviour is documented in remark as
pedanticmode (https://github.com/remarkjs/remark/blob/master/packages/remark-parse/readme.md#optionspedantic)From the README linked above
gatsby-transformer-remarksetspedantictotrueby default. Setting it to false in options should get rid of this behaviour (screenshot below).Closing this for now but feel free to reopen if there's anything else here that we can help with