Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timmarinin/ansi2html
Node.js stream to convert ANSI escape sequences (aka color codes) to HTML
https://github.com/timmarinin/ansi2html
Last synced: 1 day ago
JSON representation
Node.js stream to convert ANSI escape sequences (aka color codes) to HTML
- Host: GitHub
- URL: https://github.com/timmarinin/ansi2html
- Owner: timmarinin
- Created: 2015-06-03T21:56:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-27T08:10:26.000Z (over 8 years ago)
- Last Synced: 2024-11-13T09:53:19.450Z (2 days ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
stream-ansi2html
========![Dependencies](https://david-dm.org/marinintim/ansi2html.svg)
It is a stream to transform terminal color sequences to html tags.
## Usage
```
var ansi2html = require('stream-ansi2html')var s = Readable()
s.push('\u001b\[32m;Hello, Github')
s.push(null)s.pipe(ansi2html()).pipe(process.stdout)
// will output Hello, Github
```## Options
There is a couple of options to trigger. Pass them as first argument to `ansi2html`
```
var mySuperStream = ansi2html({ style: 'class', prefix: 'mySuperPrefix-' })
s.pipe(mySuperStream).pipe(process.stdout)
// will output Hello, Github
````style`: 'inline' | 'class'. Inline is default and will apply styles, well, inline.
Class instead only adds classes to span, you should style them. Classes are named
with this pattern: `prefix-property-value`.`prefix`: `ansi2html-` | String. Has effect only with `style: 'class'`.
## Why
This module was written to help with @marinintim/webify-workshop