Mozhi

Code Block

The shared code rendering primitive used across the Mozhi docs and showcase.

Purpose

CodeBlock is the code presentation primitive used across the docs and showcase.

Rendering model

Pass raw source with a language and the component will highlight it with Shiki. If highlighting fails, it falls back to escaped plain code so content still renders safely.

Showcase differences

Inside the homepage showcase, the surrounding panel removes the extra border from the rendered pre block. The standalone component keeps its default bordered surface.

Usage guidance

Use CodeBlock anywhere source needs to remain readable in both light and dark mode.