🚧 Rspress 2.0 document is under development
close

CodeBlockRuntime non-ejectable

Warning

This is a non-ejectable component and cannot be replaced through wrap/eject

CodeBlockRuntime renders runnable code blocks at runtime.

Usage

index.mdx
import { CodeBlockRuntime } from '@theme';

export default function Page() {
  return (
    <CodeBlockRuntime
      lang="js"
      title="index.js"
      code={`console.log('Hello World!')`}
      shikiOptions={{}}
    />
  );
}

Pass lang, title, and code to render the block; shikiOptions customizes highlighting.