example/zig-formatter: show how to use formatters from libghostty (#9407)

This commit is contained in:
Mitchell Hashimoto
2025-10-29 21:28:52 -07:00
committed by GitHub
parent c0e483c49e
commit 4a88976ef9
5 changed files with 126 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
# Example: stdin to HTML using `vtStream` and `TerminalFormatter`
This example demonstrates how to read VT sequences from stdin, parse them
using `vtStream`, and output styled HTML using `TerminalFormatter`. The
purpose of this example is primarily to show how to use formatters with
terminals.
Requires the Zig version stated in the `build.zig.zon` file.
## Usage
Basic usage:
```shell-session
echo -e "Hello \033[1;32mGreen\033[0m World" | zig build run
```
This will output HTML with inline styles and CSS palette variables.
You can also pipe complex terminal output:
```shell-session
ls --color=always | zig build run > output.html
```