Terminal syntax highlighting

@stackline/cardinal

Preserve Cardinal's compact API and exact ANSI output while gaining reliable streams, named themes, ESM, browser builds, and first-party types.

npm install @stackline/cardinal
v1.0.0Node 12+TypeScript 3.9-7.0MIT

Production browser bundle

ANSI highlighter

JavaScript or JSON

0 characters

Terminal preview

Ready

Drop-in migration

Keep the old import

An npm alias preserves the package key and existing source while selecting the maintained implementation.

npm install cardinal@npm:@stackline/cardinal
const cardinal = require('cardinal')
console.log(cardinal.highlight(source))

Public contract

Three focused methods

Full reference
MethodResultEnvironment
highlight(code, options?)ANSI-highlighted sourceNode and browser
highlightFileSync(path, options?)Highlighted UTF-8 fileNode
highlightFile(path, options?, callback)Asynchronous callbackNode
cdlFile or pipe outputTerminal

Release evidence

Compatibility is measured

179
upstream assertions
23
targeted regressions
700
differential executions
98.78%
core line coverage

Portable reference

Readable by people and tools

Migration, compatibility, security, licensing, and machine-readable references remain available without client rendering.