Displaying code in PowerPoint seems to be a pain. I came up with a simple way to get syntax highlighting in powerpoints using GitHub Gist. There may be better ways of doing this, but I found this way to be the most convenient for me on a Mac:
- Copy code from terminal (or whatever application you are viewing it in) and paste it into a GitHub Gist.
- Save gist and copy code out of the gist and into TextEdit (make sure TextEdit is in rich text mode before you paste in your code).
- Copy from TextEdit into your powerpoint and choose “keep formatting” from the paste icon that appears.
I found that creating a new text box before pasting in the code is a good idea as it allows you to control the font size of the code separate from everything else on the slide. It also allows you to set a background color for the code sample.
I know there are other ways of doing this out there, but I thought I would post my method as it’s very simple and uses GitHub’s syntax highlighting. If you have a better way of doing this I would love to hear about it!