markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

Paragraph overrides blockquote when using overrides

Open jcolakk opened this issue 3 years ago • 7 comments

Hi 👋 When using the overrides feature, paragraph overrides blockquote, not allowing to customize blockquote text differently.

Sandbox reproduction: https://codesandbox.io/s/jolly-swanson-s817n?file=/src/App.js:338-391

jcolakk avatar Jul 07 '21 09:07 jcolakk

I'm experiencing this as well.

Kolombiken avatar Sep 06 '21 15:09 Kolombiken

Any updates?

tokomeno-kaltura avatar Nov 08 '21 09:11 tokomeno-kaltura

Facing the same issue, any updates??

ritikpatni1 avatar Dec 29 '21 04:12 ritikpatni1

From the code perspective, the regular expression for blockquote is using this expression

/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/

That means a double \n\n might do the trick. but still not working correctly !

AhmedBHameed avatar Jun 29 '22 21:06 AhmedBHameed

I've opened a PR here https://github.com/probablyup/markdown-to-jsx/pull/442 Hopefully it make sense.

AhmedBHameed avatar Jul 06 '22 22:07 AhmedBHameed

The problem is we still continue processing the inner content of the blockquote to feed into your custom component, so you end up with nested paragraph tags, the deepest one being rendered by us with the coloring from the defined override…

Perhaps a way we could get around this is to inject the compiler and raw inner content as props into your custom component so you can choose to provide different options when rendering the blockquote to get your desired result.

quantizor avatar Jan 31 '23 03:01 quantizor

(This would be a breaking change, but feels like probably a good addition.)

quantizor avatar Jan 31 '23 03:01 quantizor