Skip to content

Commit 7e11c87

Browse files
authored
fix(code-block): Certain tokens not being rendered (#1236)
1 parent 7028a58 commit 7e11c87

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/code-block/src/code-block.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react/no-array-index-key */
12
import * as React from "react";
23
import type { PrismLangauge } from "./languages-available";
34
import type { Theme } from "./themes";
@@ -28,9 +29,16 @@ const CodeBlockLine = ({
2829
} else if (typeof token.content === "string") {
2930
return <span style={theme[token.type]}>{token.content}</span>;
3031
}
31-
} else if (typeof token === "string") {
32-
return token;
32+
return (
33+
<>
34+
{token.content.map((subToken, i) => (
35+
<CodeBlockLine key={i} theme={theme} token={subToken} />
36+
))}
37+
</>
38+
);
3339
}
40+
41+
return <>{token}</>;
3442
};
3543

3644
/**

0 commit comments

Comments
 (0)