diff --git a/README.md b/README.md index 9148249..167f175 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,27 @@ x.map(i => i*2); ![2](https://user-images.githubusercontent.com/1797812/48085110-042f1e00-e1bf-11e8-9a49-9fd7535fe290.gif) +### Configurable nodeVersion + +You can configure the `nodeVersion` to use by passing it as a prop to the `Code` component. + +````mdx +import Code from 'mdx-code'; + +# Regular Slide + +--- + + + +```js A playground slide! +console.log('Hello world'); +``` + + + +```` + # Authors * Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) diff --git a/index.js b/index.js index b02a093..d1f4fd0 100644 --- a/index.js +++ b/index.js @@ -5,13 +5,13 @@ import scriptLoader from "react-async-script-loader"; const Code = scriptLoader("https://embed.runkit.com")( ({ isScriptLoaded, ...rest }) => isScriptLoaded ? ( - + ) : (

Loading

) ); -export default ({ children }) => { +export default ({ nodeVersion = 10, children }) => { const [pre, code] = React.Children.toArray(children); let title; let component; @@ -20,11 +20,11 @@ export default ({ children }) => { c => c.props.children.props.children ); title = code.props.children.props.metastring; - component = ; + component = ; } else { const source = pre.props.children.props.children; title = pre.props.children.props.metastring; - component = ; + component = ; } return (