This blog post is 7 years old! Most likely, its content is outdated. Especially if it's technical.
Do you want to display some code in a Keynote presentation?
It's easy. All you need is Homebrew installed.
First you need to install the program highlight.
$ brew install highlight
So you have a piece of code. For example some Python code. The take that snippet of code and save it to a file like code.py
. Now all you need to do is run this:
$ highlight -O rtf code.py | pbcopy
Then, switch back into Keynote and simply paste.
But if you don't want to create a file of the snippet, simply copy the snippet from within your editor and run this:
$ pbpaste | highlight -S py -O rtf | pbcopy
The -S py
means "syntax is py (for python)".
You can use highlight
for a bunch of other things like creating HTML. See man highlight
for more tips.
- Previous:
- How I back up all my photos on S3 via Dropbox 28 August 2014
- Next:
- set -ex - The most useful bash trick of the year 31 August 2014
- Related by category:
- "No space left on device" on OSX Docker 03 October 2017 MacOSX
- Yet another Docker 'A ha!' moment 05 November 2017 MacOSX
- The best grep tool in the world; ripgrep
19 June 2018 MacOSX
- Build pyenv Python versions on macOS Catalina 10.15 19 February 2020 MacOSX
- When Docker is too slow, use your host 11 January 2018 MacOSX
- Related by keyword:
- How I performance test PostgreSQL locally on macOS 10 December 2018
- How do log ALL PostgreSQL SQL happening 20 July 2015
- hastebinit - quickly paste snippets into hastebin.com
11 October 2012
- Catching a carriage return in bash 23 October 2006
- String comparison function in Python (alpha) 22 December 2007