We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a51006 commit a528292Copy full SHA for a528292
src/theme/CodeBlock/index.tsx
@@ -19,14 +19,20 @@ function maybeStringifyChildren(children: ReactNode): ReactNode {
19
// The children is now guaranteed to be one/more plain strings
20
21
// If child is "$" or "$$" jump to the next line, if not add a space
22
- return React.Children.toArray(children).map((child, index) => {
+ let nodes = React.Children.toArray(children).map((child, index) => {
23
if (typeof child === 'string') {
24
if (index > 0) {
25
return child.replace(/\$\$?/g, (match) => (match === '$' ? '\n$' : ' '));
26
}
27
28
return child;
29
});
30
+
31
+ if (nodes.length === 1) {
32
+ return nodes[0];
33
+ }
34
35
+ return nodes;
36
37
38
export default function CodeBlock({
0 commit comments