Syntax highlighting for command line
Last updated 9 months ago by leichtgewicht .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @leichtgewicht/prism-cli 
SYNC missed versions from official npm registry.


Prism-cli is small script for highlighting of source code files from command line

It use awesome prism library by Lea Verou and support all languages that prism support but not all tokens are supported, ANSI colors are handled by ansi-256-colors



npm install -g prism-cli


cat {FILENAME} | prism -l {LANGAUGE}


prism -l {LANGUAGE} -f {FILENAME}

if you want to use less you need to use -R option:

prism --color=256 -l {LANGUAGE} -f {FILENAME} | less -R

You need --color option because of detection of 256 colors don't work in less because it's not real terminal. If your terminal don't support 256 colors you can use --color without argument.

If for some reason you need ANSI formatting for each line, like when you have long multiline comments and you use tail or head to get only few lines you can use -n option to have ANSI formatting on each line:

prism -l {LANGUAGE} -f {FILENAME} -n | tail -n 10

If you need to get the html code instead of the terminal output you can pass the --html parameter

prism -l {LANGUAGE} -f {FILENAME} --html


If use some language that lack of colors for prism token you can create Pull Request, I will happly merge.


Licensed under MIT license

Copyright (c) 2017 Jakub T. Jankiewicz

Current Tags

  • 0.4.0                                ...           latest (9 months ago)

1 Versions

  • 0.4.0                                ...           9 months ago
Maintainers (1)
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |