mdxjs-rs
Compile MDX to JavaScript in Rust.
When should I use this?
You can use this crate when you’re dealing with the Rust language and want
to compile MDX to JavaScript.
To parse the MDX format to a syntax tree, use markdown-rs instead.
This project does not yet support plugins.
To benefit from the unified (remark and rehype) ecosystem, use
@mdx-js/mdx.
What is this?
This Rust crate works exactly like the npm package @mdx-js/mdx.
It uses the Rust crates markdown-rs and SWC to deal with the
markdown and JavaScript inside MDX.
Questions
- to learn MDX, see
mdxjs.com - for the API, see the crate docs
- for questions, see Discussions
- to help, see contribute or sponsor below
Contents
Install
With Rust (rust edition 2018+, ±version 1.56+), install with cargo:
Use
extern crate mdxjs;
Yields (prettified):
import from 'react/jsx-runtime'
import from './snowfall.js'
export const year = 2018
export default MDXContent
API
mdxjs-rs exposes
compile,
JsxRuntime,
Options,
and a few other structs and enums.
See the crate docs for more info.
Project
Test
mdxjs-rs is tested with a lot of tests.
These tests reach all branches in the code, which means that this project has
100% code coverage.
The following bash scripts are useful when working on this project:
- run examples:
RUST_BACKTRACE=1 RUST_LOG=debug - format:
- lint:
&& - test:
RUST_BACKTRACE=1 - docs:
Version
mdxjs-rs follows SemVer.
Security
MDX is a programming language. It is JavaScript. It is not safe to let people you don’t trust write MDX.
Contribute
See contributing.md for ways to help.
See support.md for ways to get help.
See code-of-conduct.md for how to communicate in and around this
project.
Sponsor
Support this effort and give back by sponsoring:
- GitHub Sponsors (personal; monthly or one-time)
- OpenCollective or GitHub Sponsors (unified; monthly or one-time)
Thanks
Special thanks go out to:
- Vercel for funding the initial development