react-showdown
react-showdown copied to clipboard
Parser issues with content of custom components
Hi there :wave:
It looks like the parser for custom components gets confused when it's children are given over multiple lines. E.g. this works:
<Custom>
foo
bar
</Custom>
Doesn't work:
<Custom>
foo
bar
</Custom>
In the failing example, the custom component receives only ["↵ foo"]
as children.
What's also weird is that when I insert another html tag (or custom component) as a child, the library parses that and passes it as an object to the custom component.
E.g.
<Custom>
foo
<p>bla</p>
bar
</Custom>
passes: ["↵ foo↵ ", {$$typeof: Symbol(react.element), type: "p", key: "1", ref: null, props: {…}, …}, "↵ bar↵"]
as children to the custom component.
I would have expected this to pass ["↵ foo↵ <p>bla</p>↵ bar↵"]
instead.
I join the previous speaker problem
I also have a similar problem.
React component with props containing a string over multiple lines fails to be recognised.
<CustomComponent someText="Hello\n\nWorld!" />
Fails to render. One new line and it works fine.