When the markdown source has an image, which then gets wrapped in a p tag after react-markdown processes, is there any way to assign a className to that p tag, only when it is containing an image?
Or omit it alltogether. I've struggled with this for a while and it would help a lot to be able to decide if you want images to be wrapped by a paragraph. In my project, I would like the paragraph to be removed since it adds a bunch of padding that I can't remove. (Using CSSinJS so a classname wouldn't help).
@ehellman Have you seen this workaround?
this would be something that may be best handled with a remark plugin.
you can find more information on plugins here https://unifiedjs.com/learn/
a utility like https://github.com/syntax-tree/unist-util-select may help quickly target any paragraph the contains an image.
Most helpful comment
Or omit it alltogether. I've struggled with this for a while and it would help a lot to be able to decide if you want images to be wrapped by a paragraph. In my project, I would like the paragraph to be removed since it adds a bunch of padding that I can't remove. (Using CSSinJS so a classname wouldn't help).