MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / MDXCodeBox

Function MDXCodeBox

apps/site/components/MDX/CodeBox/index.tsx:7–19  ·  view source on GitHub ↗
({
  children: code,
  className,
})

Source from the content-addressed store, hash-verified

5import type { FC, HTMLAttributes } from 'react';
6
7const MDXCodeBox: FC<HTMLAttributes<HTMLElement>> = ({
8 children: code,
9 className,
10}) => {
11 const matches = className?.match(/language-(?<language>[a-zA-Z]+)/);
12 const language = matches?.groups?.language ?? '';
13
14 return (
15 <CodeBox language={getLanguageDisplayName(language)} className={className}>
16 {code}
17 </CodeBox>
18 );
19};
20
21export default MDXCodeBox;

Callers

nothing calls this directly

Calls 1

getLanguageDisplayNameFunction · 0.90

Tested by

no test coverage detected