3 ms·
Hey, thanks for the suggestion. I've used Pygments in the past and didn't even think to check if it had a PNG output mode. Here's an example of Pygments C++ ou
by mplewis 9y ago
Hey, thanks for the suggestion. I've used Pygments in the past and didn't even think to check if it had a PNG output mode.
Here's an example of Pygments C++ output:
http://imgur.com/a/7TbMb http://imgur.com/a/7TbMb
And the same file through Prism.js + Puppeteer:
https://github.com/mplewis/src2png/blob/master/docs/arduino.cpp.png https://github.com/mplewis/src2png/blob/master/docs/arduino....
Pygments does a great job of generating detailed PNGs. The default settings aren't quite what I'm looking for, but they look like they could be tweaked to increase the resolution and change the color scheme.
I'm embedding my examples in a Keynote deck, so I'm picky about font family, size, resolution, etc. I bet I could get similar results by writing a custom script for Pygments. Thanks for sharing!
- adambrenecki 9y agoIf you're copying code into a Keynote presentation, you can use Pygments' RTF output mode, copy it to the clipboard, and just paste it into a text box in Keynote. That way, because it's actual text, it's smooth regardless of output resolution. Here's an example I just pulled from my shell history: pygmentize -f rtf -O "fontface=Fira Code,fontsize=26" -l prolog familyinteract.pl | pbcopy (That was for pasting code into Pages; for Keynote you'll probably want a bigger font size.)
- jackblack8989 9y agoSo it's not a "slide" deck, it's a keynote deck? Ok Mr "Hacker". I get the entire point of your useless project now. lol