({
children,
className,
icon: _icon,
...props
}: CodePreProps)
| 123 | }; |
| 124 | |
| 125 | export const CodePre = ({ |
| 126 | children, |
| 127 | className, |
| 128 | icon: _icon, |
| 129 | ...props |
| 130 | }: CodePreProps) => { |
| 131 | const codeChild = getCodeChild(children); |
| 132 | const codeChildren = codeChild?.props.children ?? children; |
| 133 | const language = |
| 134 | getLanguageFromClassName(codeChild?.props.className) || |
| 135 | getLanguageFromClassName(className); |
| 136 | const code = getNodeText(codeChildren).trimEnd(); |
| 137 | |
| 138 | return ( |
| 139 | <CodeWrapper language={highlightLanguage(language)} code={code}> |
| 140 | <pre {...props} className={cx(classes.code, className)}> |
| 141 | <code className={cx(classes['code-inner'], codeChild?.props.className)}> |
| 142 | {codeChildren} |
| 143 | </code> |
| 144 | </pre> |
| 145 | </CodeWrapper> |
| 146 | ); |
| 147 | }; |
| 148 | |
| 149 | export const CodeMdx = (props: CodeProps) => { |
| 150 | const language = getLanguageFromClassName(props.className); |
nothing calls this directly
no test coverage detected