0.0.9 • Published 2 years ago

ansi-html v0.0.9

Weekly downloads
9,184,338
License
Apache-2.0
Repository
github
Last release
2 years ago

ansi-html NPM version Build Status

An elegant lib that converts the chalked (ANSI) text to HTML.

Coverage

  • All styles of chalk (100%) and colors.
  • There are over 150 randomized test cases under test.

Installation

$ npm install ansi-html

Usage

var ansiHTML = require('ansi-html');
var str = ansiHTML('[ANSI_TEXT]');

e.g.:

var chalk = require('chalk');

var str = chalk.bold.red('foo') + ' bar';
console.log('[ANSI]', str)
console.log('[HTML]', ansiHTML(str));

See complete examples under test / examples directory.

Set Colors

ansiHTML.setColors({
  reset: ['555', '666'], // FOREGROUND-COLOR or [FOREGROUND-COLOR] or [, BACKGROUND-COLOR] or [FOREGROUND-COLOR, BACKGROUND-COLOR]
  black: 'aaa',	// String
  red: 'bbb',
  green: 'ccc',
  yellow: 'ddd',
  blue: 'eee',
  magenta: 'fff',
  cyan: '999',
  lightgrey: '888',
  darkgrey: '777'
});

Reset

ansiHTML.reset();

Exposed Tags

var openTags = ansiHTML.tags.open;
var closeTags = ansiHTML.tags.close;

Test

$ npm install -l
$ npm test
vuedragdropuploadimages@parcel-nightly-unofficial/utilswebpack-dev-server-http2bb-chat@frxf/frxf@texttree/demo-bsa-reference-rclares-next@cloudkite/next@l1nyanm1ng/react-picture-viewercthpb-plugin-social@infinitebrahmanuniverse/nolb-ans@everything-registry/sub-chunk-1143@explodingcamera/nextoly-core@heww/nuxt@hsjs/react-refresh-webpack-plugin@gatsbyjs/react-refresh-webpack-plugin@gutenye/react-dev-utils@ericmcornelius/ease@hugomrdias/documentation@idarex/nuxt@ideasonpurpose/build-tools-wordpress@ffwdmusic/next@gospry/next@gem-mine/webpack-dev-server@gem-mine/webpack-hot-middleware@glenjamin/webpack-hot-client-overlay@eps1lon/webpack-dev-server@jacobmischka/mdx-deck@jamshop/eleventy-filter-dumpfreemamba@kirrosh/pts@kozakl/webpack-dev-server@kristoffertonning/vue-laravel-errors@luban-cli/cli-plugin-service@liuweiheng19906666/lwh-demo2@lwh19906666/lwh-demo2iungo@pi0/nuxt@pi0/nuxt-start@piuccio/next@prometheusresearch/react-dev-utilsvcloudcam-playkit-js-hlsvd-clijanda-bolong@procensus/webpack-dev-server@pixeloven/webpack-dev-server-middleware@pixeloven-webpack/server-middleware@pixeloven-webpack/hot-middlewarejet-nextjesusdemo@rbc-public/react-selectable-fastkafirchain-tetrisvue-compmentkoa-bundle@rohitpal/nuxtfuture-eng-nextflowable-bpmn-modeler@joshua3212/next_ui@jesstelford/mdx-deckforever-webgrunt-terminal-browserhls-standalone-serverhohenheimguvnorgull-seed@ngxvoice/ngx-voicelistnerwebpack-serve-overlaywebsked-webpack-dev-serverweld-nextwds-bannertus-standalone-serverinteract-next@paulcbetts/nextucf-scripts@resin.io/next@renovatesimply/react-dev-utilsview-photo@packem/dev-plugintw-components@nrser/ugh@npmcorp/nexthot-zone-vue@nuxt/sigmahelp-widget@movableink-se/se-scriptstest-stream-nexttest-test-43h4h29423@oliver_lou/webpack-dev-server2@vitali_shcherbina/styled-lib@vjpr/next@upsidetravel/nextmext-scriptsmxmp-climncssn3tr-next@webapp-suite/webpack-hot-middlewareneo4j-etl-uinext-custom-routesnext-clone
0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

8 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago