A Vite plugin that allows importing Markdown files as React components, with support for frontmatter, code demos, and table of contents. Version 0.0.0-dev.10 is a development release with no stable cadence. It is inspired by dumi and provides exports like MdContent, MdDemos, frontmatter, and slugs. Compared to alternatives like vite-plugin-md or mdx, this plugin focuses on React components and demo rendering, but is still in early development and lacks production maturity.
npm install vite-plugin-react-mdocNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin in vite.config.js and use MdContent and MdDemos from a Markdown file in a React component.
Pin to a specific version or avoid in production.
Use ESM imports: import mdoc from 'vite-plugin-react-mdoc'
Add declare module '*.md' as shown in README.
Render MdDemos as {MdDemos.map(demo => <demo.Component />)}Run: npm install vite-plugin-react-mdoc --save-dev
Use: import mdoc from 'vite-plugin-react-mdoc'
Create a .d.ts file (e.g., vite.d.ts) with: declare module '*.md' { ... }Add 'import React from 'react' at the top of the file.