anser

A low-level parser that converts ANSI escape-sequence text into structured tokens or HTML

Library
npm
v2.3.5
80 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
38 /100 Needs Attention
Development Activity 0
Maintenance 32
Community 48
Maturity 60
Momentum 12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
68 /100 Good
Architecture 62
Code Quality 68
Innovation 55
Learning Curve 85

anser parses strings containing ANSI escape codes — the foreground/background colors, bold/italic/underline styling, and cursor-control sequences terminal programs emit — and turns them into either structured token objects (content plus resolved style) or ready-to-render HTML with inline styles or CSS classes applied. It supports the standard 16/256-color ANSI palettes as well as 24-bit true-color escape sequences.

Because it has no DOM or Node-specific dependency, anser is used both server-side (formatting captured CLI output for a web dashboard or log viewer) and in the browser (rendering colored terminal output inside a web-based console), and is a common dependency behind tools that need to display raw terminal/CI output as readable, styled HTML.

What You Get

  • ansiToJson() - parses ANSI-coded text into an array of structured token objects (content, fg/bg color, style flags)
  • ansiToHtml() - converts ANSI-coded text directly into HTML with inline styles or CSS classes
  • ansiToText() - strips ANSI codes to produce plain text
  • Support for standard 16-color, 256-color, and 24-bit true-color ANSI sequences
  • TypeScript type definitions (lib/index.d.ts) for all exported functions

Common Use Cases

  • Rendering colored CI/build-log output inside a web-based dashboard or log viewer
  • Displaying captured terminal output (from a PTY or child_process) as styled HTML in an Electron or browser-based app
  • Converting stored ANSI-coded log text into plain text for search indexing or plain-text export
  • Building custom terminal-emulator-adjacent tooling that needs a dependency-light ANSI parser rather than a full terminal emulator

Under The Hood

Architecture - The entire implementation lives in a single lib/index.js module exporting an Anser class with static ansiToJson/ansiToHtml/ansiToText methods; internally it tokenizes the input string by scanning for the ESC (\x1b[) sequence prefix, accumulates styling state (foreground/background color, bold/italic/underline flags) across sequences, and emits one token per contiguous run of identically-styled text.

Tech Stack - Plain, dependency-free JavaScript (CommonJS, lib/index.js as both the source and published entry point) with hand-written TypeScript declarations; no build step is required since the published package is the source itself.

Code Quality - The single test/ansi_up-test.js suite (named for the project it was originally derived from) exercises color/style parsing via Mocha, and jshint/jslint provide static linting; the codebase is compact (~630 lines) which keeps its ANSI-parsing edge cases relatively easy to review, though recent commit activity has slowed.

API Design - The three top-level static methods (ansiToJson, ansiToHtml, ansiToText) cover the common conversion needs with a single function call each and an options object for things like class-name-based vs inline-style HTML output, making integration straightforward for both server- and browser-side consumers.

Used by 6 apps in this directory

Go
73%
GPL 3.0

1Panel

Devops · Hosting Control Panel · Monitoring

37,044

The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.

View details
91
Repo Health
76
Technical
67
Dependency
Built with
Go 73%
Vue 27%
Updated 4 days ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
TypeScript
84%
Apache 2.0

Continue

AI Code Assistants · AI Development · Automation

36,049

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
73
Repo Health
88
Technical
62
Dependency
Built with
TypeScript 84%
Updated 5 days ago
TypeScript
96%
MIT

deepseek-harness

AI Agents · AI Development · Developer Tools

237,945

An open-source, plugin-based agent harness from DeepSeek AI that runs coding and automation agents across web, desktop, CLI, and SDK surfaces.

View details
81
Repo Health
89
Technical
74
Dependency
Built with
TypeScript 96%
Updated 5 days ago
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,450

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 1 weeks ago
TypeScript
99%
Other

LobeHub

AI Assistants · Automation · Productivity

82,864

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
TypeScript 99%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers