markdown-to-jsx
markdown-to-jsx copied to clipboard
Parse component props uncorrectly
I'm using a string like this
'<CodeBlock data={[{ a: [{ b: 1 }] }]} />'
I expect data
is [{ a: [{ b: 1 }] }]
, unfortunately the result is {[{ a: [{ b: 1 }] }
which ]}
in the end is missing.
In the origin code I found this regexp, and this cause the problem
const ATTR_EXTRACTOR_R = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi;
Can you add a failing test?
@probablyup I made a demo in code sandbox, maybe you can get it. https://codesandbox.io/s/inspiring-wildflower-o2b0x?file=/src/App.js
Any solution to this?
@quantizor any movement here?