Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@acarl005/cli-highlight
Advanced tools
cli-highlight
Syntax highlighting in your terminal
Output a file
$ highlight package.json
Color output of another program with piping. Example: A database migration script that logs SQL Queries
$ db-migrate --dry-run | highlight
Command line options:
Usage: highlight [options] [file]
Outputs a file or STDIN input with syntax highlighting
Options:
--language, -l Set the langugage explicitely
If omitted will try to auto-detect
--theme, -t Use a theme defined in a JSON file
--version, -v Show version number [boolean]
--help, -h Show help [boolean]
You can use this module programmatically to highlight logs of your Node app. Example:
const highlight = require('cli-highlight').highlight
const Sequelize = require('sequelize')
const db = new Sequelize(process.env.DB, {
logging(log) {
console.log(highlight(log, {language: 'sql', ignoreIllegals: true}))
}
})
Detailed API documenation can be found here.
You can write your own theme in a JSON file and pass it with --theme
.
The key must be one of the highlight.js CSS class names
and the value must be one or an array of Chalk styles to be applied to that token.
{
"keyword": "blue",
"built_in": ["cyan", "dim"],
"string": "red"
}
The theme is combined with the default theme. The default theme is still not colored a lot or optimized for many languages, PRs welcome!
In theory, all languages of highlight.js are supported - I just did not adapt the default theme and wrote tests for all languages yet. My primary use case was SQL so that is supported well.
The module is written in TypeScript and can be compiled with npm run build
.
npm run watch
starts tsc
in watch mode. Tests are written with mocha.
Improving language support is done by adding more colors to the tokens in the default theme and writing more tests.
FAQs
Syntax highlighting in your terminal
We found that @acarl005/cli-highlight 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.