pygments

Generic syntax highlighter written in Python for code snippets

brewmacoslinux
Try with needOr install directly
Source

About

Generic syntax highlighter

Commands

pygmentize

Examples

Highlight a Python file and display in terminal with color$ pygmentize -f terminal256 script.py
Convert code to HTML with syntax highlighting$ pygmentize -f html -o output.html source.py
Highlight code with a specific lexer and formatter$ pygmentize -l javascript -f bbcode script.js