Skip to content

Commit 58893e2

Browse files
committed
fix code blocks
1 parent 227ca33 commit 58893e2

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/components/MDX/MDXComponents.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,3 @@ export const MDXComponents = annotateMDXComponents({
461461
YouTubeIframe,
462462
ErrorDecoder,
463463
});
464-
465-
// for (let key in MDXComponents) {
466-
// if (MDXComponents.hasOwnProperty(key)) {
467-
// const MDXComponent: any = (MDXComponents as any)[key];
468-
// MDXComponent.mdxName = key;
469-
// }
470-
// }

src/components/MDX/Sandpack/createFileMap.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,21 @@ export const createFileMap = (codeSnippets: any) => {
1313
return codeSnippets.reduce(
1414
(result: Record<string, SandpackFile>, codeSnippet: React.ReactElement) => {
1515
// TODO: actually fix this
16-
// if (
17-
// (codeSnippet.type as any).mdxName !== 'pre' &&
18-
// codeSnippet.type !== 'pre'
19-
// ) {
20-
// return result;
21-
// }
2216
const {props} = (
2317
codeSnippet.props as PropsWithChildren<{
2418
children: ReactElement<
25-
HTMLAttributes<HTMLDivElement> & {meta?: string}
19+
HTMLAttributes<HTMLDivElement> & {
20+
meta?: string;
21+
'data-mdx-name'?: string;
22+
}
2623
>;
2724
}>
2825
).children;
2926

27+
if (props?.['data-mdx-name'] !== 'code') {
28+
return result;
29+
}
30+
3031
let filePath; // path in the folder structure
3132
let fileHidden = false; // if the file is available as a tab
3233
let fileActive = false; // if the file tab is shown by default

0 commit comments

Comments
 (0)