The Web Dev Notes Blog Presents:

Syntax Highlighting Outside Your Editor

Article Continues Below

Whether you’re giving a talk, sharing work with your team, or presenting work to your clients, there comes a time when you’ll need to show code outside of a text editor. Copying and pasting code from a text editor to say, Keynote, is an easy process. The difficulties come in when you want to preserve syntax highlighting, which is crucial to bringing code to life.

I’m in the midst of building a few talks that contain a lot of code, so I’ve been exploring tools to improve my workflow from my editor of choice, Sublime Text, to Keynote. I was looking for the easiest way to copy code as rich text—with my preferred color scheme, font face, and font size applied—to be pasted directly into Keynote.

The first tool I tried was a Sublime Text package, installed with Package Control, called SublimeHighlight. With SublimeHighlight installed, you can select code and trigger a command to copy the code to your clipboard as rich text.

Available SublimeHighlight commands

Built on top of Pygments, it’s a really nice package for Sublime Text that fits my workflow perfectly. However, the available format options didn’t feel extensive or powerful, and I seemed to be doing a lot of tweaking in Keynote. The speed of copying directly out of Sublime Text was outweighed by the time I spent in Keynote.

I began looking for a tool that would allow me to spend less time tweaking styles in Keynote, and found Highlight, a command line utility with a terrifying amount of documentation. Fear not; the learning curve is low, and the possibilities are endless. To install it, either follow the instructions, or if you’re running OS X and Homebrew, just run brew install highlight.

To achieve my direct-to-Keynote nirvana, I played with the available command line options a bit until I was satisfied. What I came up with looked like this:

highlight -O rtf -t 2 -K 40 -k 'Source Code Pro' --style twilight _output.js | pbcopy

Though verbose, it’s not as complicated as it looks: -O rtf sets the output format to rich text, -t 2 sets tabs to 2 spaces, -K 40 sets font size to 40, and -k 'Source Code Pro' sets the font face to Source Code Pro, my preferred font face. I created a theme to match my preferred color scheme, Twilight, and specify its use by including --style twilight. To use this without the custom theme, just leave the --style twilight out.

The final bit, _output.js | pbcopy, tells Highlight to run _output.js, the file containing code to be processed, through its formatter and copy the results to the clipboard. All I have to do is run that line, paste into Keynote, and I have a perfectly formatted chunk of code.

It’s not the perfect workflow by any means, but I love the amount of flexibility and control Highlight provides. You can see how I’ve been making heavy use of this tool in talks that I’ve posted to Speaker Deck.

Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

7 Reader Comments

  1. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Yeah… I just copy and paste from PHP Storm and it keeps my text highlighting.
    I guess other JetBrains IDEs do that too if you work in Python/Ruby/Java

  2. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    It looks like you have not stumbled into ExportHTML.

  3. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    In Komodo Edit 8 (free) you just need to export it to html by using:
    File > Print > Print to html file
    Once in html you can open it with your browser and copy paste it to textedit for example.

    Another alternative is to use highlightjs

  4. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    @BlueScreenJunky didn’t work for me, but made me install this plugin and now it works like described by you 🙂

  5. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    You can do the same with Panic’s Coda by selecting the code and choosing “Copy with Styles”.

  6. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Using highlight gives the flexibility when you use editors like SublimeText, TextMate or even Vim (my preferred choice). However, to augment this process, it can be turned into an Alfred app workflow, so you wouldn’t even need to visit the terminal. 🙂

  7. Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    For anything to put into the blogs or website, i use a open source online tool as detailed in this link Syntax Highlight Generator

Got something to say?

We have turned off comments, but you can see what folks had to say before we did so.

More from ALA

Designed for a Dead Language

Every language app in your pocket inherited a teaching method built for Latin. Understanding why that happened is a more useful design lesson than anything the apps themselves can teach you.
Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

Good designers, bad websites: a proposal

Designers are good people. Some designs exclude people anyway. Alan Dalton offers a practical fix: accessibility personas that help you recognize problems while you're designing, not after. Homework included.
Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

Design for Amiability: Lessons from Vienna

Computing was born in a Viennese café. Between 1928 and 1934, while Hitler plotted and Europe crumbled, a motley crew of mathematicians, philosophers, architects, and economists gathered weekly to puzzle out the limits of reason—and invented Computer Science in the process. What made their collaboration possible wasn't just brilliance (though they had plenty). It was amiability: the careful design of a social space where difficult people could disagree without destroying each other. Longtime Web Dev Notes contributing author Mark Bernstein mines this forgotten history for lessons that might just save today's embattled web from its worst impulses. Spoiler: it involves better coffee service and the looming threat of public humiliation.
Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

Design Dialects: Breaking the Rules, Not the System

Design systems aren't component libraries—they’re living languages. Rigid adherence to visual rules creates brittle systems that break under contextual pressure. Fluent systems bend without breaking.
Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

Discover more from Web Dev Notes

Subscribe now to keep reading and get access to the full archive.

Continue reading