Closed jaredpalmer closed 5 years ago
@jaredpalmer
Thanks for trying out v2 and letting us know about this. Its quite a coincidence that I was just reading https://mdxjs.com/guides/live-code/ recently and was thinking about this too.
I will look into this.
On another note, are you hosting your code somewhere ? We will most likely have breaking changes in subsequent alpha. we can help you update if you are adopting it early
@endiliey my branch for formik 2 docs is here https://github.com/jaredpalmer/formik/tree/feat/docsite
@jaredpalmer
Thanks, I'll try my best to spend time to help you update for subsequent version. Actually we don't want people to swizzle too much at this point because we're in alpha and few things are still experimental. Didn't really expect someone to start swizzling already :)
If we do prism highlighting at render-time in React and not in the mdx loader, it would allow people to get access to code blocks as strings instead of html. This would make it easy for folks to add live code editors like react-live.
We could keep the default prism setup too if we follow this guide in the MDX docs: https://mdxjs.com/guides/live-code#live-code.
The benefits are pretty rad. I made a video of my setup for the formik v2 docs.
My swizzled
<DocsItem>
looks like this. As you can see, I am wrapping the DocContent with MDXProvider so I can override the code component with my playground.