Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Last active February 4, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaraVieira/0ab9e0746c5408f62cbf1db1d95113f8 to your computer and use it in GitHub Desktop.
Save SaraVieira/0ab9e0746c5408f62cbf1db1d95113f8 to your computer and use it in GitHub Desktop.
import React from 'react'
import { MDXProvider } from '@mdx-js/tag'
import { Global, css } from '@emotion/core'
const code = ({ className, children }) => {
if (className === 'language-cssx') {
return (
<Global
styles={css`
${children}
`}
/>
)
}
return <code>{children}</code>
}
export default ({ children, components }) => (
<MDXProvider components={{ ...components, code }}>{children}</MDXProvider>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment