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

How to remove outer <div> or outer <span>?

Open bryandandan opened this issue 5 years ago • 2 comments
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...

bryandandan avatar Aug 04 '20 16:08 bryandandan

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

quantizor avatar Oct 08 '20 14:10 quantizor

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 });

coreyward avatar Mar 05 '21 22:03 coreyward