Skip to content
Merged
Changes from all commits
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
15 changes: 13 additions & 2 deletions packages/runtime/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,25 @@ npm i -S @mdx-js/runtime
import React from 'react'
import MDX from '@mdx-js/runtime'

// Provide custom components for markdown elements
const components = {
h1: props => <h1 style={{ color: 'tomato' }} {...props} />
}

const mdx = '# Hello, world!'
// Provide custom components that will be referenced as JSX
// in the markdown string
const scope = {
Demo: props => <h1>This is a demo component</h1>
}

const mdx = '
# Hello, world!

<Demo />
'

export default () => (
<MDX components={components}>{mdx}</MDX>
<MDX components={components} scope={scope}>{mdx}</MDX>
)
```

Expand Down