Capability first · transport second

AnsiText.js

Parses terminal ANSI sequences into display spans or strips them to plain text.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Parses terminal ANSI sequences into display spans or strips them to plain text.

  • Artifact
    AnsiText.js · esm
  • Classification
    public first party
  • Availability
    Cross-host
  • Normalization
    Normalized text/span output.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/AnsiText.js';

Pure ANSI parsing and stripping with no terminal I/O.

Application-facing behavior: parseAnsi(), stripAnsi().

Protocol and host implementation

In-process only This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
parseAnsifunctionfunction parseAnsi(input='')input=''
stripAnsifunctionfunction stripAnsi(input='')input=''
CallableKindExact public signatureParameter syntax
parseAnsiexported-functionfunction parseAnsi(input='')input=''
stripAnsiexported-functionfunction stripAnsi(input='')input=''

Parameter meanings and results

parseAnsi(input) returns a frozen token array of {text, style}; stripAnsi(input) returns plain text and supports standard SGR styling plus indexed colors.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

This artifact has no additional documented lifecycle event flow.

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

No additional module-specific rejection behavior is documented.

Availability and capabilities

Cross-host. Normalized text/span output.

Normalizes terminal display text; it does not invoke the Core shell.

Contract example

JavaScript
import {parseAnsi, stripAnsi} from '/arcane/modules/AnsiText.js';

const input='\u001b[31mError\u001b[0m';
console.log(parseAnsi(input),stripAnsi(input));

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.