streamdown-syntax-0.1.0 has been yanked.
Streamdown Syntax
This crate provides syntax highlighting for code blocks using the syntect library. It's designed to work with streaming input (line-by-line) for real-time rendering.
Features
- Streaming highlighting - Maintain state across lines for multi-line tokens
- Language aliases - Map common names (py, js, ts) to proper syntax definitions
- Background override - Override theme background for consistent code block styling
- ANSI output - Generate 24-bit true color terminal escape codes
Example
use Highlighter;
let highlighter = new;
// Highlight a complete code block
let code = "fn main() {\n println!(\"Hello!\");\n}";
let highlighted = highlighter.highlight_block;
// For streaming, use HighlightState
use HighlightState;
let mut hl = new;
let mut state = hl.new_highlight_state;
let line1 = hl.highlight_line_with_state;
let line2 = hl.highlight_line_with_state;