MCPcopy Index your code
hub / github.com/fontsource/fontsource / CodePre

Function CodePre

website/app/components/code/Code.tsx:125–147  ·  view source on GitHub ↗
({
	children,
	className,
	icon: _icon,
	...props
}: CodePreProps)

Source from the content-addressed store, hash-verified

123};
124
125export 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
149export const CodeMdx = (props: CodeProps) => {
150 const language = getLanguageFromClassName(props.className);

Callers

nothing calls this directly

Calls 4

highlightLanguageFunction · 0.90
getCodeChildFunction · 0.85
getLanguageFromClassNameFunction · 0.85
getNodeTextFunction · 0.85

Tested by

no test coverage detected