Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ElMassimo/vite-plugin-xdm
Use XDM in VIte.js
https://github.com/ElMassimo/vite-plugin-xdm
markdown mdx vite-plugin xdm
Last synced: about 2 months ago
JSON representation
Use XDM in VIte.js
- Host: GitHub
- URL: https://github.com/ElMassimo/vite-plugin-xdm
- Owner: ElMassimo
- License: mit
- Archived: true
- Created: 2021-09-14T02:18:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-04T19:44:32.000Z (almost 3 years ago)
- Last Synced: 2024-06-03T02:31:27.000Z (4 months ago)
- Topics: markdown, mdx, vite-plugin, xdm
- Language: JavaScript
- Homepage:
- Size: 112 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
vite-plugin-xdm
[plugin]: https://github.com/ElMassimo/vite-plugin-xdm
[vite.js]: http://vitejs.dev/
[xdm]: https://github.com/wooorm/xdm## Why? 🤔
[xdm] is distributed as ESM-only, which makes it difficult to use
in [Vite.js] projects that have any CJS dependencies.This plugin is a light wrapper around [xdm] that can receive plugins as promises,
simplifying the usage to avoid `async` and `await` wrappers.## Installation 💿
Install the package as a development dependency:
```bash
npm i -D vite-plugin-xdm # yarn add -D vite-plugin-xdm
```## Usage 🚀
You can provide any options that [xdm] would receive for MDX compilation.
```js
import { defineConfig } from 'vite'
import xdm from 'vite-plugin-xdm'export default defineConfig({
plugins: [
xdm(
remarkPlugins: [
'remark-frontmatter',
import('remark-mdx-frontmatter').then(mod =>
[(mod.default || mod).remarkMdxFrontmatter, { name: 'frontmatter' }]
),
],
rehypePlugins: [
['@mapbox/rehype-prism', { alias: { markup: ['html', 'vue'] } }],
],
),
],
})
```Promises are also supported with `rehypePlugins`.
## Acknowledgements
- [xdm] — Excellent library, fast, and very well documented.
## License
This library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).