Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add MDX 3 community plugin #1102

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions src/languages/mdx.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ eleventyNavigation:
order: 16
---

[MDX](https://mdxjs.com) is a variant of [Markdown](https://daringfireball.net/projects/markdown/) that compiles to JSX, and supports embedding interactive components inside Markdown documents. Parcel supports MDX automatically using the `@parcel/transformer-mdx` plugin. When a `.mdx` file is detected, it will be installed into your project automatically.
[MDX](https://mdxjs.com) is a variant of [Markdown](https://daringfireball.net/projects/markdown/) that compiles to JSX, and supports embedding interactive components inside Markdown documents.

## Example usage
## MDX v1 usage

Parcel supports MDX v1 automatically using the `@parcel/transformer-mdx` plugin. When a `.mdx` file is detected, it will be installed into your project automatically.

First, install `@mdx-js/react`. This is needed to render MDX files as React components.

Expand Down Expand Up @@ -41,3 +43,32 @@ This is a pretty cool MDX file.

{% endsamplefile %}
{% endsample %}

## MDX v3 usage

If you're using MDX v3, community plugin [`parcel-transformer-mdx`][1] is recommended, Babel & TypeScript configuration can be loaded automatically.

### Installation

```shell
npm i @parcel/config-default parcel-transformer-mdx -D
```

### Configuration

{% sample %}
{% samplefile ".parcelrc" %}

```json
{
"extends": "@parcel/config-default",
"transformers": {
"*.{md,mdx}": ["parcel-transformer-mdx"]
}
}
```

{% endsamplefile %}
{% endsample %}

[1]: https://img.shields.io/librariesio/github/EasyWebApp/Parcel-transformer-MDX.svg