Loading...

Keynote + Highlight = <3

keynote highlight love

In every person’s life, there is a situation, where he or she wants to share knowledge and need to do some presentation. If that person is a developer, there’s big chance that embedding code in a presentation will be required.

Some time ago I had a problem with that. I’ve tried pasting code without any formatting, pasting screenshots and showing code in an editor. Jumping from IDE to presentation uncomfortable and sometimes ‘something’ happens, your computer freezes and you’re done. The not formatted code looked terrible and screenshots had a problem with scaling. Lately, I found something interesting

Solution: Highlight

Highlight is a great tool for converting code into HTML, LaTeX i RTF and some others. RTF is format supported by keynote and we’re going to use it.

How does it look?
Formatted code in keynote

It’s readable, it’s embedded as text so it should look good independently from screen resolution. If you do not like colours, you can use one of many ready templates or just create one yourself.

How to use Highlight?

Installation

Mac Users

brew install highlight

Linux & Windows users
You have to compile it for your system. Visit Installation Guide and follow instructions

Conversion

My conversion command:

highlight -O RTF source_file.rb --line-numbers --style fine_blue --src-lang ruby | pbcopy

Short explanation
`-O RTF` sets RTF format on output
`–line-numbers` Adds line numbers. Optional
`–style fine_blue` uses fine_blue theme. You can change it as you like
`–src-lang ruby` sets source language to ruby. You can change it to your favourite language

My commands pipes output to `pbcopy` which just puts it in the clipboard. Now, you can copy it into keynote and it’ll look great! You can adjust font size and anything you want in a keynote.
Voilà!
Note: `pbcopy` is Mac OS tool. You can use `xclip` on linux and I have no idea about windows.

Highlight is an awesome tool. It works out-of-the-box but remains flexible. You can adjust anything, create own theme, plugins, language supports and anything you can imagine.

This is the only tool that I liked for formatting code and I wish I knew about it few months sooner.

If you have something better for embedding code in presentations put it in comments. I’ll appreciate.

If you like it, you can follow me on twitter/facebook or subscribe to push notifications(red mark in the left down corner of the page).

Leave a Reply

Social media & sharing icons powered by UltimatelySocial