Papyrus CLI
Instant terminal-based article & documentation reader with dark theme
What needed to be solved
Reading documentation and tech articles often involves dealing with popups, auto-playing video ads, and bloated navigation headers that break focus.
How I engineered the solution
Built a CLI binary that fetches web pages, parses raw HTML content, strips unnecessary layout noise, and renders formatted markdown directly into your terminal.
Core components & data flow
- Commander.js CLI argument parsing pipeline
- Cheerio & Turndown HTML content extraction engine
- Ink React-based terminal rendering component layout
The bottleneck & breakthrough
Preserving syntax highlighting for code snippets embedded inside nested HTML pre tags across various terminal color themes.
Engineering chronology & pivots
Initially relied on simple regex HTML stripping. This broke code block formatting, merged text paragraphs together, and stripped essential technical code snippets.
Adopted a structural AST pipeline using Cheerio DOM parsing combined with Turndown markdown conversion, preserving clean hierarchy and code blocks.
Implemented Ink React components to render ANSI terminal text with responsive terminal window width wrapping and dark mode syntax highlighting.
What I Learned
Terminal layout primitives, ANSI color space escaping, and DOM sanitization techniques.
Measurable Result
Delivers instant distraction-free terminal reading in under 200ms per article fetch.
Need high-performance web systems built?
I craft custom full-stack web platforms, local-first architectures, and accessible design systems. Let's discuss your project.