mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 09:33:21 +00:00
30 lines
685 B
TypeScript
30 lines
685 B
TypeScript
import type { ContentKitCodeBlock } from '@gitbook/api';
|
|
import type React from 'react';
|
|
|
|
import type { ContentKitClientElementProps } from './types';
|
|
|
|
export function ElementCodeBlockClient(
|
|
props: ContentKitClientElementProps<ContentKitCodeBlock> & {
|
|
/**
|
|
* Render a code block on the server as a fallback and swap only when needed.
|
|
*/
|
|
children: React.ReactNode;
|
|
}
|
|
) {
|
|
const { children } = props;
|
|
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export function DefaultCodeBlock(props: {
|
|
code: string;
|
|
syntax: string;
|
|
lineNumbers: number | boolean;
|
|
}) {
|
|
return (
|
|
<pre>
|
|
<code>{props.code}</code>
|
|
</pre>
|
|
);
|
|
}
|