<code-block>
A lightweight Web Component for displaying code with syntax highlighting, copy functionality, line numbers, and theme support.
Features
Syntax Highlighting
13+ languages supported via highlight.js including JavaScript, Python, CSS, HTML, JSON, YAML, and more.
Multi-File Tabs
Group related files in a tabbed interface with <code-block-group>.
Line Highlighting
Draw attention to specific lines with the highlight-lines attribute.
External File Loading
Load code from URLs with the src attribute. Auto-detects language from file extension.
Focus Mode
Dim non-highlighted lines to draw attention to specific code sections.
Light & Dark Themes
GitHub-inspired color schemes with full CSS custom property support.
Quick Start
Installation
Install via npm:
Or include via CDN: