| Crates.io | html_view_cli |
| lib.rs | html_view_cli |
| version | 0.1.0 |
| created_at | 2025-12-17 19:57:25.256017+00 |
| updated_at | 2025-12-17 19:57:25.256017+00 |
| description | A command-line interface for rendering HTML content using the HTMLView library. |
| homepage | |
| repository | https://github.com/jmg049/HTMLView |
| max_upload_size | |
| id | 1991054 |
| size | 29,449 |
Command-line interface for the html_view HTML viewer.
Install both the viewer app and the CLI tool:
# From the workspace root
cargo install --path html_view_app
cargo install --path html_view_cli
Both will be installed to ~/.cargo/bin/ (ensure this is in your PATH).
html_view_cli [SUBCOMMAND] [OPTIONS]
html - Display inline HTMLhtml_view_cli html "<h1>Hello, World!</h1>"
html_view_cli html "<h1>Title</h1><p>Content</p>" --width 800 --height 600
file - Display a local HTML filehtml_view_cli file index.html
html_view_cli file ./build/index.html --title "My App"
dir - Display an HTML application directoryhtml_view_cli dir ./dist
html_view_cli dir ./build --entry main.html
The --entry option specifies which HTML file to load (defaults to index.html).
url - Display a remote URLhtml_view_cli url https://example.com
html_view_cli url https://docs.rs/html_view --width 1200
All subcommands support these options:
--width <pixels> - Set window width (default: 1024)--height <pixels> - Set window height (default: 768)--title <string> - Set window title--devtools - Enable developer tools for debugging--timeout <seconds> - Auto-close window after N secondsQuick HTML preview:
html_view_cli html "<h1>Quick Test</h1>"
View documentation:
cargo doc --no-deps
html_view_cli file target/doc/my_crate/index.html
Preview a static site:
# Build your static site
npm run build
# View it
html_view_cli dir ./dist
Debug a web page:
html_view_cli file debug.html --devtools
Temporary notification:
html_view_cli html "<h1>Build Complete!</h1>" \
--timeout 5 \
--width 400 \
--height 200
Custom window:
html_view_cli html "<h1>Custom</h1>" \
--width 800 \
--height 600 \
--title "My Custom Window"
Pipe HTML from another command:
cat template.html | html_view_cli html "$(cat -)"
View with styling:
html_view_cli html '
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: Arial; padding: 40px; }
h1 { color: #4A90E2; }
</style>
</head>
<body>
<h1>Styled Content</h1>
<p>This is a styled HTML page.</p>
</body>
</html>
'
Environment Files: Save commonly used HTML snippets and load them:
html_view_cli html "$(cat my-template.html)"
Integration with Build Tools: Add to your build scripts:
# In package.json or Makefile
cargo build && html_view_cli html "<h1>Build Success!</h1>" --timeout 3
Data Visualization: Generate HTML reports and view them:
./my-analyzer --format html > report.html
html_view_cli file report.html
Testing: Quickly test HTML without opening a browser:
html_view_cli html "<button onclick='alert(\"test\")'>Click</button>" --devtools
The html_view_app binary must be installed and available. The CLI will look for it in:
~/.cargo/bin/html_view_app (preferred location)HTML_VIEW_APP_PATH environment variablehtml_view_cliIf you get a "binary not found" error, ensure html_view_app is installed:
cargo install --path html_view_app
libwebkit2gtk-4.1-dev)MIT OR Apache-2.0