Gathering detailed insights and metrics for cli-highlight
Gathering detailed insights and metrics for cli-highlight
Gathering detailed insights and metrics for cli-highlight
Gathering detailed insights and metrics for cli-highlight
npm install cli-highlight
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
308 Stars
112 Commits
31 Forks
8 Watching
46 Branches
8 Contributors
Updated on 31 Oct 2024
TypeScript (72.42%)
1C Enterprise (9.17%)
Groovy (4.93%)
Zephir (3.66%)
Hy (3.4%)
XQuery (2.38%)
Scheme (2.29%)
Shell (0.8%)
HTML (0.59%)
JavaScript (0.36%)
Cumulative downloads
Total Downloads
Last day
-7.3%
719,839
Compared to previous day
Last week
3.8%
3,868,152
Compared to previous week
Last month
14.8%
16,121,456
Compared to previous month
Last year
32.2%
141,442,035
Compared to previous year
19
Syntax highlighting in your terminal
Output a file
1$ highlight package.json
Color output of another program with piping. Example: A database migration script that logs SQL Queries
1$ db-migrate --dry-run | highlight
Command line options:
1Usage: highlight [options] [file] 2 3Outputs a file or STDIN input with syntax highlighting 4 5Options: 6 --language, -l Set the langugage explicitely 7 If omitted will try to auto-detect 8 --theme, -t Use a theme defined in a JSON file 9 --version, -v Show version number [boolean] 10 --help, -h Show help [boolean]
You can use this module programmatically to highlight logs of your Node app. Example:
1const highlight = require('cli-highlight').highlight 2const Sequelize = require('sequelize') 3 4const db = new Sequelize(process.env.DB, { 5 logging(log) { 6 console.log(highlight(log, {language: 'sql', ignoreIllegals: true})) 7 } 8})
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 or "default"
,
and the value must be one or an array of Chalk styles to be applied to that token.
1{ 2 "keyword": "blue", 3 "built_in": ["cyan", "dim"], 4 "string": "red", 5 "default": "gray" 6}
The style for "default"
will be applied to any substrings not handled by highlight.js. The specifics depend on the language but this typically includes things like commas in parameter lists, semicolons at the end of lines, etc.
The theme is combined with the default theme. The default theme is still not colored a lot or optimized for many languages, PRs welcome!
All languages of highlight.js are supported. Check a CI build for examples of all the different languages and their highlighting.
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.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 2/20 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
64 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More