Skip to content

Commit

Permalink
Improve runtime docs, closes #1176 (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
johno authored and wooorm committed Dec 17, 2020
1 parent 7398b98 commit 84304b2
Show file tree
Hide file tree
Showing 2 changed files with 200 additions and 711 deletions.
13 changes: 13 additions & 0 deletions packages/runtime/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ yarn add @mdx-js/runtime

Say we have the following scripts, `example.jsx`:

### Props

The MDX Runtime component accepts two props:

| Name | Description |
| ------------ | ---------------------------------------------------------------- |
| `components` | Globally available components for the runtime |
| `scope` | Variables that are accessible in the JSX portion of the document |

### Example code

```jsx
import React from 'react'
import {renderToString} from 'react-dom/server'
Expand All @@ -54,6 +65,8 @@ const children = `
{1 + somethingInScope}
<Demo />
<div>Here is the scope variable: {some}</div>
`

const result = renderToString(
Expand Down
Loading

0 comments on commit 84304b2

Please sign in to comment.