text: import React from "react"
  import { MDXProvider } from "@mdx-js/react"
  import { Code } from "./src/components/code"
  
  const preToCodeBlock = preProps => {
    if (
      preProps.children &&
      preProps.children.props &&
      preProps.children.props.mdxType === "code"
    ) {
      const {
        children: codeString,
        className = "",
        ...props
      } = preProps.children.props
  
      const match = className.match(/language-([\0-\uFFFF]*)/)
  
      return {
        codeString: codeString.trim(),
        className,
        language: match != null ? match[1] : "",
        ...props,
      }
    }
    return undefined
  }
  
  const components = {
    pre: preProps => {
      const props = preToCodeBlock(preProps)
      if (props) {
        return <Code {...props} />
      } else {
        return <pre {...preProps} />
      }
    },
  }
  export const wrapRootElement = ({ element }) => (
    <MDXProvider components={components}>{element}</MDXProvider>
  )
  