No description
- C 89.3%
- Makefile 6.2%
- Shell 4.5%
| include | htmlfilt: initial commit | |
| libhtml | Fix out-of-source builds | |
| man | drop the ANSI build option which is a remnant of a previous life of this code | |
| mk | Fix out-of-source builds | |
| src | Fix out-of-source builds | |
| tests | Fix out-of-source builds | |
| .editorconfig | feat: add editorconfig | |
| .gitignore | update .gitignore | |
| configure | Sync with latest bbuild | |
| configure.def | Release 0.3.0 | |
| Kyuafile | Allow make test and make distcheck | |
| LICENSE | Add BSD 2-Clause license file | |
| Makefile.in | Allow make test and make distcheck | |
| README.md | htmlfilt: initial commit | |
htmlfilt
A command-line HTML to plain text converter for FreeBSD.
htmlfilt parses HTML documents, applies CSS styling, and renders the content as formatted text in the terminal, with optional ANSI escape codes for visual formatting.
Features
- HTML parsing with support for most common elements (headings, paragraphs, lists, tables, links, blockquotes, preformatted text, etc.)
- CSS stylesheet parsing and inline style support
- ANSI escape code output for bold, italic, colors, text decoration, and
background colors (enabled by default, disable with
-a) - Capsicum sandboxing for privilege separation on FreeBSD
- Configurable output width (default 80 columns)
- Input from stdin or file
Usage
htmlfilt [-a] [-w width] [file]
Options
| Option | Description |
|---|---|
-a |
Disable ANSI escape codes |
-w |
Set terminal width (default 80) |
Examples
Read from stdin:
echo '<h1>Hello World</h1>' | htmlfilt
Read from a file:
htmlfilt document.html
Disable ANSI formatting:
htmlfilt -a document.html
Set a custom width:
htmlfilt -w 60 document.html
Building
Prerequisites
- A C compiler (GCC or Clang)
- POSIX make
- Optionally ATF (Automated Test Framework) for tests
Build steps
./configure
make
This produces the src/htmlfilt binary and the libhtml/libhtml.a static
library.
Tests
If ATF is available on the system, tests are automatically enabled. Run them with:
make test