Skip to main content

Module code_block

Module code_block 

Source
Expand description

Ported from Arc (MIT) © 2026 Elia Kuratli Reference: Arc源码/arc-library/registry/components/code-block/code-block.tsx & .module.css

P6 Component #10: code-block

  • Framed syntax-highlighted source code viewer with file header, language badge, built-in CopyButton writing directly to the OS clipboard, and optional max_lines collapse/expand bar with rotating vector chevron (SpringSpec::SNAPPY).

Structs§

CodeBlock
Syntax-highlighted source code viewer with copy button & collapsible footer (code-block).
CodeSpan
One tokenized text span on a line of source code.

Enums§

CodeTokenKind
Lightweight syntax token category matching code-block.tsx.

Functions§

tokenize_code_line
Tokenizes a single line of source code into colored spans (Rust / TS / JS / JSON / SQL / CSS).