import React from "react" import clsx from "clsx" import { useThemeConfig, usePrismTheme } from "@docusaurus/theme-common" import { parseCodeBlockTitle, parseLanguage, parseLines, containsLineNumbers, useCodeWordWrap, } from "@docusaurus/theme-common/internal" import Highlight, { defaultProps, type Language } from "prism-react-renderer" import Line from "@theme/CodeBlock/Line" import Container from "@theme/CodeBlock/Container" import type { Props } from "@theme/CodeBlock/Content/String" import useIsBrowser from "@docusaurus/useIsBrowser" import { ThemeConfig } from "@medusajs/docs" import { CopyButton, Tooltip } from "docs-ui" import { ExclamationCircleSolid, SquareTwoStackSolid } from "@medusajs/icons" export default function CodeBlockString({ children, className: blockClassName = "", metastring, title: titleProp, showLineNumbers: showLineNumbersProp, language: languageProp, noReport = false, noCopy = false, }: Props): JSX.Element { const { prism: { defaultLanguage, magicComments }, reportCodeLinkPrefix = "", } = useThemeConfig() as ThemeConfig const language = languageProp ?? parseLanguage(blockClassName) ?? defaultLanguage const prismTheme = usePrismTheme() const wordWrap = useCodeWordWrap() const isBrowser = useIsBrowser() // We still parse the metastring in case we want to support more syntax in the // future. Note that MDX doesn't strip quotes when parsing metastring: // "title=\"xyz\"" => title: "\"xyz\"" const title = parseCodeBlockTitle(metastring) || titleProp const { lineClassNames, code } = parseLines(children, { metastring, language, magicComments, }) const showLineNumbers = showLineNumbersProp ?? containsLineNumbers(metastring) return ( {title &&
{title}
}
{({ className, tokens, getLineProps, getTokenProps }) => ( <>
                 1 &&
                      "table p-1 code-block-numbering",
                    title && "p-1",
                    !title && tokens.length > 1 && "p-1",
                    !title && tokens.length === 1 && "py-0.5 pr-0.5 pl-1"
                  )}
                >
                  {tokens.map((line, i) => (
                     1}
                    />
                  ))}
                
              
1 && "top-1" )} > {!noReport && ( )} {!noCopy && ( )}
)}
) }