markdown-to-jsx
markdown-to-jsx copied to clipboard
How to remove outer <div> or outer <span>?
trafficstars
Is there a way to remove the outer div/span created?
Example: aaa bbb
will result in
<div>
<p>aaa</p>
<p>bbb</p>
</div>
I just want the 2 paragraphs...
Yeah, I've been wanting to replace the outer div with a fragment but it's not supported in React v15. Will probably add a config option for this
You can do this now:
<Markdown options={{ wrapper: React.Fragment }} />
If you really want an array back with no wrapper, I suggest using the compiler directly:
import { compiler } from "markdown-to-jsx";
compiler('One\n\nTwo\n\nThree', { wrapper: null });