standout-render
Rich terminal output with templates, themes, and automatic light/dark mode support.
use ;
use Style;
let theme = new
.add
.add;
let output = render?;
Why standout-render?
Terminal output is stuck in the 1970s: scattered println! statements, cryptic ANSI escape codes, and presentation logic tangled with business logic. Every change requires recompilation. Nobody bothers with polish because iteration is painful.
standout-render fixes this with ideas borrowed from web development:
- Templates — MiniJinja (Jinja2 syntax) for readable, declarative output
- Style tags — BBCode-like
[style]content[/style]syntax, not escape codes - Themes — Centralized style definitions in CSS or YAML
- Hot reload — Edit templates during development, see changes instantly
- Graceful degradation — Same template renders rich or plain based on terminal
The result: output that's easy to write, easy to change, and looks polished.
Features
Two-Pass Rendering Pipeline
Template + Data → MiniJinja → Text with style tags → BBParser → ANSI output
- Pass 1: Variable substitution, loops, conditionals (MiniJinja)
- Pass 2: Style tag replacement with ANSI codes (or stripping for plain text)
Adaptive Themes
Automatic OS detection for light/dark terminals:
# theme.yaml
title:
fg: cyan
bold: true
panel:
light:
bg: "#f5f5f5"
dark:
bg: "#1a1a1a"
Or CSS syntax:
}
{
}
}
Multiple Output Modes
One template, many formats:
// Rich terminal output
render_with_output?;
// Plain text (pipes, redirects)
render_with_output?;
// Structured data (skip template entirely)
render_auto?;
render_auto?;
Tabular Layout
Sophisticated column formatting with world-class alignment and layout:
{% set t = tabular([
{"name": "id", "width": 8},
{"name": "name", "width": "fill"},
{"name": "status", "width": 10, "anchor": "right"}
], separator=" ") %}
{% for entry in entries %}
{{ t.row([entry.id, entry.name, entry.status]) }}
{% endfor %}
Features: flexible truncation (start/middle/end), expanding columns, word wrapping, multi-line row alignment, justification, variable width, fractional sizing—all Unicode-aware and ANSI-safe.
Hot Reload
During development, templates reload from disk on each render:
let mut renderer = new?;
renderer.add_template_dir?;
// Edit templates/report.jinja, re-run, see changes immediately
let output = renderer.render?;
In release builds, templates embed into the binary—no runtime file access.
Quick Start
[]
= "2.1"
= { = "1", = ["derive"] }
= "1"
use ;
use Serialize;
Documentation
Guides
- Introduction to Rendering — Complete rendering tutorial
- Introduction to Tabular — Column layouts and tables
Topics
- Styling System — Themes, adaptive styles, CSS syntax
- Templating — MiniJinja, style tags, processing modes
- File System Resources — Hot reload, registries, embedding
Reference
- API Documentation — Full API reference
Used By
This crate provides the rendering foundation for the standout CLI framework, which adds command dispatch, hooks, and clap integration. Use standout-render directly when you want rendering without the framework.
License
MIT