Highlighted code syntax in Keynote

30 August 2014   0 comments   MacOSX

Mind That Age!

This blog post is 4 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.

Comments

Your email will never ever be published


Related posts

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 Keyword:
How do log ALL PostgreSQL SQL happening 20 July 2015
Migration of Postgres 9.2 to 9.3 with Homebrew and json_enhancements 30 April 2014
hastebinit - quickly paste snippets into hastebin.com 11 October 2012
TornadoGists.org - launched and ready! 06 April 2011
To code or to pdb in Python 20 December 2010
Related by Text:
jQuery and Highslide JS 08 January 2008
I'm back! Peterbe.com has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
Ever wondered how much $87 Billion is? 04 November 2003
Guake, not Yakuake or Yeahconsole 23 January 2010