Skip to content

Instantly share code, notes, and snippets.

@yemartin
Created June 17, 2015 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yemartin/df25314d1310035d81ab to your computer and use it in GitHub Desktop.
Save yemartin/df25314d1310035d81ab to your computer and use it in GitHub Desktop.
Highlight code snippet in the clipboard, making it ready to be pasted into keynote.
#!/bin/bash
#
# Dependency: highlight (http://www.andre-simon.de/doku/highlight/en/highlight.php)
# $ brew install highlight
#
# Usage:
# 1. Copy some code snippet into the clipboard.
# 2. $ pbhighlight [syntax] # syntax parameter is optional. Default set below.
# 3. Paste into Keynote.
#
SYNTAX=$1
: ${SYNTAX:=ruby} # <----- Your default syntax here
# Customize styling below to your liking
pbpaste \
| highlight \
--out-format rtf \
--line-numbers \
--font-size 24 \
--font Inconsolata \
--style bclear \
--encoding=utf8 \
--wrap \
--wrap-no-numbers \
--line-length 80 \
--line-number-length 2 \
--syntax $SYNTAX \
| pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment