Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

using self-closing components in the same line results in only the first one being added to the react tree #54

Closed
n1ru4l opened this issue Apr 19, 2020 · 1 comment · Fixed by #55

Comments

@n1ru4l
Copy link
Contributor

n1ru4l commented Apr 19, 2020

CodeSandbox with reproduction:

https://codesandbox.io/s/epic-snow-6oz96?file=/src/App.js:417-482

Using two components in the same line result in only the first one being added to the react tree.
This is kind of a deal-breaker for inline span elements e.g. for multiple Link components that are inside a sentence.

With MDX this is possible (tested on https://mdxjs.com/playground).

I think it is related to self-closing tags. The following works as expected:

<CustomComponent name="world"></CustomComponent> <b a="lmao">lmao</b>

Using the recognizeSelfClosing option for htmlparser seems to resolve this issue (see 50bfaef).

n1ru4l added a commit to n1ru4l/react-showdown that referenced this issue Apr 19, 2020
@n1ru4l n1ru4l changed the title using two components in the same line results in only the first one being added to the react tree using self-closing components in the same line results in only the first one being added to the react tree Apr 19, 2020
n1ru4l added a commit to n1ru4l/dungeon-revealer that referenced this issue May 1, 2020
@christoph-jerolimov
Copy link
Owner

@n1ru4l a new version 2.1.0 is released with all your changes! Thank for contributing

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants