To support JSX in MDX, we use the rehype-raw
plugin. This allows us to parse and render raw HTML within MDX files.
We use GitHub Actions to deploy our site to GitHub Pages. The deployment workflow is defined in the .github/workflows/deploy.yml
file.
To set up MDX with JSX support and deploy to GitHub Pages, follow these steps:
- Add
rehype-raw
to therehypePlugins
array innext.config.js
. - Ensure
pageExtensions
includesmdx
innext.config.js
. - Add
@mdx-js/loader
todependencies
inpackage.json
. - Add
gh-pages
todevDependencies
inpackage.json
. - Add a
deploy
script toscripts
inpackage.json
. - Create a simple React component with a heading in
pages/index.js
. - Ensure the
publish_dir
is set to./out
in.github/workflows/deploy.yml
.