19 lines
492 B
TypeScript
19 lines
492 B
TypeScript
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
|
|
interface StyledCodeProps {
|
|
children: string;
|
|
language?: string;
|
|
}
|
|
|
|
const StyledCode = (props: StyledCodeProps) => (
|
|
<SyntaxHighlighter
|
|
customStyle={{ margin: "0" }}
|
|
style={highlightStyle}
|
|
language={props.language || "python"}
|
|
>
|
|
{props.children}
|
|
</SyntaxHighlighter>
|
|
);
|
|
|
|
export default StyledCode;
|