![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ansi-html-community
Advanced tools
An elegant lib that converts the chalked (ANSI) text to HTML. (Community)
The ansi-html-community package is a utility for converting ANSI escape codes in strings into HTML. This is particularly useful for displaying styled console output (like colors, bold, underline) directly on web pages.
Convert ANSI codes to HTML
This feature allows you to convert strings containing ANSI escape codes into HTML, enabling the display of styled text in web applications.
const ansiHTML = require('ansi-html-community');
const str = '\u001b[31mHello World\u001b[39m';
const html = ansiHTML(str);
console.log(html); // Outputs: '<span style="color:#FF0000;">Hello World</span>'
This package also converts ANSI codes to HTML. It is similar to ansi-html-community but offers different configuration options and might have different handling of certain ANSI codes.
Chalk is a popular package for styling terminal output with ANSI codes but does not convert to HTML. It is used primarily in Node.js scripts for enhancing console output readability.
An elegant lib that converts the chalked (ANSI) text to HTML.
$ npm install ansi-html-community
var ansiHTML = require('ansi-html-community');
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.
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'
});
ansiHTML.reset();
var openTags = ansiHTML.tags.open;
var closeTags = ansiHTML.tags.close;
$ npm install -l
$ npm test
FAQs
An elegant lib that converts the chalked (ANSI) text to HTML. (Community)
The npm package ansi-html-community receives a total of 11,112,187 weekly downloads. As such, ansi-html-community popularity was classified as popular.
We found that ansi-html-community demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.