4 ms·
Maybe a stupid Q - i assume there is a good reason - most likely related to syntax clash… Why is this not a component? as in: <Markdown> Text </Markdown>
by andreasklinger 10y ago
Maybe a stupid Q - i assume there is a good reason - most likely related to syntax clash…
Why is this not a component?
as in:
<Markdown>
Text
</Markdown>
- tlrobinson 10y agoLooks like it's advertised as "zero-overhead", i.e. it gets compiled by Babel at build time. Not sure it would make a big difference for most apps though. I think more importantly it allows you to use JSX inside of your Markdown, and use custom React components in place of normal HTML elements that Markdown would normally emit. I like the idea of a <Markdown> component though.
- LeanderK 10y agoi am not really into this stuff, but would this be a good use for http://webcomponents.org http://webcomponents.org?
- svachalek 10y agoIt would not be hard to create a web component that translates markdown at runtime; there are probably a few in there already. But that's a very different use-case than transpilation. Personally, I don't see much need for handling this at compile-time, but it is what it is, and runtime rendering is a different thing entirely.
- Goosey 10y agoThere already exist multiple Markdown components, for example https://github.com/rexxars/react-markdown https://github.com/rexxars/react-markdown The interesting thing here is that it is inline. edit: No judgement if being inline is a pro or a con. Personally I prefer to keep it in a specific component, but I see the appeal fo this
- svachalek 10y agoIf it was passed as "children" rather than a named prop, it should look pretty similar. It just wouldn't be pre-compiled.