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
CopyButtonwriting directly to the OS clipboard, and optionalmax_linescollapse/expand bar with rotating vector chevron (SpringSpec::SNAPPY).
Structs§
- Code
Block - Syntax-highlighted source code viewer with copy button & collapsible footer (
code-block). - Code
Span - One tokenized text span on a line of source code.
Enums§
- Code
Token Kind - 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).