| Crates.io | streamdown |
| lib.rs | streamdown |
| version | 0.1.3 |
| created_at | 2025-12-31 20:52:04.32589+00 |
| updated_at | 2025-12-31 21:05:15.318864+00 |
| description | A streaming markdown renderer for modern terminals (Rust port of Streamdown) |
| homepage | https://github.com/fed-stew/streamdown-rs |
| repository | https://github.com/fed-stew/streamdown-rs |
| max_upload_size | |
| id | 2015360 |
| size | 153,626 |
A streaming markdown renderer for modern terminals, written in Rust.
This is a Rust port of Streamdown by kristopolous, bringing the same beautiful terminal markdown rendering with the performance and safety of Rust.
git clone https://github.com/fed-stew/streamdown-rs.git
cd streamdown-rs
cargo install --path .
cargo install streamdown
# Pipe from any command
echo "# Hello World" | sd
# Render a file
cat README.md | sd
# From an LLM
curl -s https://api.openai.com/... | sd
sd document.md
# Run a command in a PTY and render its markdown output
sd --exec "python chat.py"
sd -e "llm query 'explain rust lifetimes'"
sd - Streamdown: A streaming markdown renderer for terminals
USAGE:
sd [OPTIONS] [FILE]
ARGS:
<FILE> Markdown file to render (reads from stdin if omitted)
OPTIONS:
-e, --exec <CMD> Execute command and render its output
-w, --width <WIDTH> Terminal width (default: auto-detect)
-c, --config <FILE> Custom config file path
-s, --scrape <DIR> Save code blocks to directory
-d, --debug Enable debug output
-h, --help Print help information
-V, --version Print version information
Streamdown looks for configuration in:
$XDG_CONFIG_HOME/streamdown/config.toml~/.config/streamdown/config.toml~/.streamdown.toml[style]
# Base hue (0.0-1.0) for color theme
hue = 0.6
# Terminal margin (spaces on left)
margin = 2
[style.multipliers]
# HSV multipliers for derived colors
dark = [1.0, 0.8, 0.15]
mid = [1.0, 0.5, 0.4]
symbol = [1.0, 0.6, 0.7]
head = [1.0, 0.4, 0.9]
grey = [0.0, 0.0, 0.5]
bright = [1.0, 0.8, 1.0]
[features]
# Enable OSC 52 clipboard for code blocks
clipboard = true
# Enable savebrace (save code to temp file)
savebrace = true
# Prompt pattern for PTY mode (regex)
prompt_pattern = "[$#>] $"
The color theme is generated from a single base hue using HSV color space. Adjust the hue value (0.0-1.0) to change the overall color scheme:
0.0 - Red0.3 - Green0.6 - Blue (default)0.8 - Purple# Level 1 Heading
## Level 2 Heading
### Level 3 Heading
Rendered with bold text and proper centering.
```python
def hello():
print("Hello, World!")
```
Rendered with:
| Name | Age | City |
|-------|-----|------- |
| Alice | 30 | NYC |
| Bob | 25 | LA |
Rendered with Unicode box drawing characters.
- Item 1
- Nested item
- Deeply nested
- Item 2
1. First
2. Second
3. Third
Rendered with proper indentation and bullets.
<think>
Internal reasoning that should be visually distinct...
</think>
Special rendering for LLM "thinking" output.
Use streamdown as a library in your Rust project:
use streamdown_parser::Parser;
use streamdown_render::Renderer;
fn main() {
let markdown = "# Hello\n\nThis is **bold** text.";
let mut output = Vec::new();
let mut parser = Parser::new();
{
let mut renderer = Renderer::new(&mut output, 80);
for line in markdown.lines() {
for event in parser.parse_line(line) {
renderer.render_event(&event).unwrap();
}
}
}
print!("{}", String::from_utf8(output).unwrap());
}
| Crate | Description |
|---|---|
streamdown-core |
Core types, traits, and state management |
streamdown-ansi |
ANSI escape codes and terminal utilities |
streamdown-config |
Configuration loading and style computation |
streamdown-parser |
Streaming markdown parser |
streamdown-syntax |
Syntax highlighting via syntect |
streamdown-render |
Terminal rendering engine |
streamdown-plugin |
Plugin system (LaTeX, etc.) |
cargo build
cargo build --release
# Run all tests
cargo test --workspace
# Run specific crate tests
cargo test -p streamdown-parser
# Run with output
cargo test -- --nocapture
cargo doc --workspace --open
| Feature | Python | Rust |
|---|---|---|
| Streaming parsing | ✅ | ✅ |
| Syntax highlighting | ✅ (Pygments) | ✅ (syntect) |
| Tables | ✅ | ✅ |
| Code blocks | ✅ | ✅ |
| Lists (nested) | ✅ | ✅ |
| Think blocks | ✅ | ✅ |
| PTY exec mode | ✅ | ✅ |
| Clipboard (OSC 52) | ✅ | ✅ |
| Savebrace | ✅ | ✅ |
| LaTeX to Unicode | ✅ | ✅ |
| Configuration | ✅ | ✅ |
| Performance | Good | Excellent |
| Memory safety | Manual | Guaranteed |
| Binary size | ~50MB (with Python) | ~5MB |
MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit issues and pull requests.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)