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

Bug: Component's name that's a prefix of another can't be nested

Open desiprisg opened this issue 1 year ago • 2 comments

Noticed this while implementing an <Accordion />. I've added overrides for <Accordion /> and <AccordionItem /> and it seems that when nesting these, the outside element is not placed correctly.

Simplified example:

overrides: {
     Accordion: ({ children }) => children,
     AccordionItem: ({ children }) => children,
}

will yield: image

If Accordion was not a prefix of AccordionItem, this would work as expected.

desiprisg avatar Dec 06 '23 12:12 desiprisg

Hi @desiprisg , I think you should adjust the indentation of the components you've added. Here is an example with the same case that I've already created.

image

alfianyusufabdullah avatar Dec 17 '23 14:12 alfianyusufabdullah

@alfianyusufabdullah The issue appears when the nested component has a different name (prefixed by the first component's name). Try naming the second one CalloutSubmission2.

desiprisg avatar Dec 18 '23 14:12 desiprisg