quantizor / markdown-to-jsx

🏭 The most lightweight, customizable React markdown component.
https://markdown-to-jsx.quantizor.dev/
MIT License
2.01k stars 174 forks source link

Markdown stops rendering after custom components #497

Open SParmentier opened 1 year ago

SParmentier commented 1 year ago

If we want to use a bold for example after a custom component, the markdown will render correctly the custom component but not the following text. It seems to be only when the markdown is on multi lines.

const Text = (props) => <span style={{ color: 'red' }}>{props.children}</span>

# Important to put on multi lines here
const markdown = `
<Text>Hello world!</Text> **bold**
`;

<Markdown options={{ overrides: { Text: { component: Text } } }} >
  {markdown}
</Markdown>

Expected: bold Result: **bold**

It was working fine in version 7.1.5 but not since 7.1.6.

bhainesva commented 1 year ago

I'm also experiencing this, with default html elements as well as custom components.

Can reproduce on https://probablyup.com/markdown-to-jsx/ with (the newline is important):

<div></div> **bold**

image

I'm using 7.2.1, downgrading to 7.1.5 also fixes it for me.

ghorela3ishan commented 5 months ago

Facing same issue on 7.4.7. @quantizor any updates/plans to fix this ?

quantizor commented 5 months ago

Will try to take a look this weekend

ghorela3ishan commented 3 months ago

@quantizor Were you able to check this ?