-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Built-in Markdown/MDX Support #141
Comments
RE: pages, I think a good compromise is to use the |
Thanks for adding markdown support! A few of thoughts:
EDIT: A quick additional note on why 3 would be really nice to have as part of this project. I haven’t managed to get MDX imports working at all for various reasons. The biggest one (when trying xdm) is that snowpack uses CJS config, whilst xdm is ESM. However, this project is ideally placed to import ESM code for use in Snowpack plugins since it interacts directly with the Snowpack API. I don’t think this is a compelling reason, because this is entirely a Snowpack issue (not supporting mjs config), but it would be really nice if Microsite could make MDX just work. |
I've pushed up a WIP Markdown integration under the
feat/mdx
branch! Give it a spin locally and let me know if you have any feedback.The package source is under
packages/markdown
with an example atexamples/markdown
. It is powered by esbuild viaxdm
.You'll notice that it supports both plan
.md
files as well as.mdx
. You may customize the rendering of any element by passing a Preact component for that element's tag name ({ components: { a: (props) => <a {...props} /> } }
). Unlike NextJS's built-in markdown support, this integration does not allow Markdown/MDX files to be used aspages/
, but I think this is the most flexible choice for the same reasons outlined innext-mdx-remote
's README. Unlikenext-mdx-remote
, hydration is handled entirely by Microsite, so only your components wrapped inwithHydrate
are rehydrated on the client. I'd be very interested in hearing your thoughts on this integration!cc @ratorx
The text was updated successfully, but these errors were encountered: