This script is a quick way to migrate existing Astro-flavoured Markdown pages in an Astro project to MDX pages.
It does the following:
- Loads all
*.md
files in yoursrc/pages/
directory - Parses each page’s frontmatter
- Moves the contents of
setup
in frontmatter into the main file body as required for imports in MDX - Writes the updated contents of each page to the same location but as
.mdx
instead of.md
- Deletes the original
.md
file