MCPcopy Create free account
hub / github.com/analogdotnow/Analog / CodeBlock

Function CodeBlock

apps/web/src/components/ai-elements/code-block.tsx:30–101  ·  view source on GitHub ↗
({
  code,
  language,
  showLineNumbers = false,
  className,
  children,
  ...props
}: CodeBlockProps)

Source from the content-addressed store, hash-verified

28};
29
30export const CodeBlock = ({
31 code,
32 language,
33 showLineNumbers = false,
34 className,
35 children,
36 ...props
37}: CodeBlockProps) => (
38 <CodeBlockContext.Provider value={{ code }}>
39 <div
40 className={cn(
41 "relative w-full overflow-hidden rounded-md border bg-background text-foreground",
42 className,
43 )}
44 {...props}
45 >
46 <div className="relative">
47 <SyntaxHighlighter
48 language={language}
49 style={oneLight}
50 customStyle={{
51 margin: 0,
52 padding: "1rem",
53 fontSize: "0.875rem",
54 background: "hsl(var(--background))",
55 color: "hsl(var(--foreground))",
56 }}
57 showLineNumbers={showLineNumbers}
58 lineNumberStyle={{
59 color: "hsl(var(--muted-foreground))",
60 paddingRight: "1rem",
61 minWidth: "2.5rem",
62 }}
63 codeTagProps={{
64 className: "font-mono text-sm",
65 }}
66 className="overflow-hidden dark:hidden"
67 >
68 {code}
69 </SyntaxHighlighter>
70 <SyntaxHighlighter
71 language={language}
72 style={oneDark}
73 customStyle={{
74 margin: 0,
75 padding: "1rem",
76 fontSize: "0.875rem",
77 background: "hsl(var(--background))",
78 color: "hsl(var(--foreground))",
79 }}
80 showLineNumbers={showLineNumbers}
81 lineNumberStyle={{
82 color: "hsl(var(--muted-foreground))",
83 paddingRight: "1rem",
84 minWidth: "2.5rem",
85 }}
86 codeTagProps={{
87 className: "font-mono text-sm",

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected