Skip to content

Commit

Permalink
chore(docs): add mdx-embed guide (#1400)
Browse files Browse the repository at this point in the history
* Add MDX Embed guide to readme

* Move to guides
  • Loading branch information
PaulieScanlon authored Dec 21, 2020
1 parent e975888 commit e905f9c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ to add to them by [contributing](/contributing)!
- [**\[WIP\]** Implement a dynamic table of contents](/guides/table-of-contents)
- [**\[WIP\]** Use MDX in a Vue project](/guides/vue)
- [Use markdown content in components](/guides/markdown-in-components)
- [Embed 3rd Party media content with MDX Embed](/guides/mdx-embed)

## Customizing

Expand Down
34 changes: 34 additions & 0 deletions docs/guides/mdx-embed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# MDX Embed

With [MDX Embed](https://www.mdx-embed.com/) you can [politely embed](https://www.gatsbyjs.com/blog/hacktoberfest-spotlight-mdx-embed/) and load 3rd party media content such as Twitter, CodePen, CodeSandbox, Egghead Lessons, Gists and many more in your `.mdx`, no **import** required!

## Install

```sh
npm install mdx-embed --save
```

## Setup

Wrap your application with the `MDXEmbedProvider` to allow your `.mdx` to render all of the provided components

```javascript
import React from 'react'
import {MDXEmbedProvider} from 'mdx-embed'

export default props => <MDXEmbedProvider>{props.children}</MDXEmbedProvider>
```

### Usage

```javascript
// some-mdx-file.mdx
#### My cool pen

Here's a pen, and some other blog post text
<CodePen codePenId="PNaGbb" />
```
For the full installation and information about the various MDX packages visit the [docs](https://www.mdx-embed.com)

0 comments on commit e905f9c

Please sign in to comment.