Pygments wrapper for Chroma: Use chroma lexers in Pygments, when Chroma is not an option.
- Have Chroma installed:
chroma
must be available in yourPATH
, before installing this plugin. - Install this plugin via
pip
:$ pip install git+https://github.com/tobb10001/shitty-pygments-chroma-wrapper
- Check your installation with
pygments -L
. All Chroma lexers should be displayed. - Profit.
shitty-pygments-chroma-wrapper
is a Pygments plugin. During installation, it calls
chroma --list
and parses its output in order to generate a list of all available
lexers in order to generate the entry points for Pygments.
During execution this same list is used to create one Lexer
class per Chroma lexer,
where Pygments expects them due to the entry points. When this classes
get_tokens_unprocessed
method is called, it invokes Chroma with the --json
option to
let chroma generate a list of tokens. Those tokens are then mapped to Pygments tokens
and returned.