1

I want to print out some code on paper including syntax highlighting. After some research, I found out, that I could do this with pygments and enscript, but don't know how to combine these tools. Obviously there must be someone out there, who has done this before. Or is there a better way of doing it?
BTW: I know I can do this in vim too, but I don't like how it prints out JSON files.

uloco
  • 2,283
  • 4
  • 22
  • 37

1 Answers1

1

Depending on what output format you want, you may not actually need enscript. Pygments can render your input to various formats, including html, rtf, latex and various others.

You can call pygments on the command line passing input file and output format.

To let pygments render a json file to html use ...

$ pygmentize -f html -o foobar.html foobar.json

To render to rtf use ...

$ pygmentize -f rtf -o foobar.rtf foobar.json

Available output formats are listed at:

http://pygments.org/docs/formatters/

trijezdci
  • 5,284
  • 2
  • 19
  • 15