Skip to content

Instantly share code, notes, and snippets.

@yemartin

yemartin/pbhighlight

Created Jun 17, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.