mirror of
https://github.com/vercel/streamdown.git
synced 2026-09-19 02:18:37 +08:00
75faa2ed26
* Bundle minimal languages, load excess from CDN * Update cdn-loader.ts * Proxy rewrite CDN urls * Create bold-worms-enjoy.md * Update code-blocks.mdx * Delete unused pages * Add new CDN unit tests * Run Ultracite * Manual fixes * Update sidebar.tsx
32 lines
787 B
TypeScript
32 lines
787 B
TypeScript
import type { ComponentProps } from "react";
|
|
import { cn } from "../utils";
|
|
|
|
type CodeBlockContainerProps = ComponentProps<"div"> & {
|
|
language: string;
|
|
};
|
|
|
|
export const CodeBlockContainer = ({
|
|
className,
|
|
language,
|
|
style,
|
|
...props
|
|
}: CodeBlockContainerProps) => (
|
|
<div
|
|
className={cn(
|
|
"my-4 w-full overflow-hidden rounded-xl border border-border",
|
|
className
|
|
)}
|
|
data-language={language}
|
|
data-streamdown="code-block"
|
|
style={{
|
|
// Use content-visibility to skip rendering off-screen blocks
|
|
// This can significantly improve performance for large documents
|
|
contentVisibility: "auto",
|
|
// Provide a hint for layout to prevent layout shifts
|
|
containIntrinsicSize: "auto 200px",
|
|
...style,
|
|
}}
|
|
{...props}
|
|
/>
|
|
);
|