Skip to content

Instantly share code, notes, and snippets.

@guich-wo
Created February 14, 2018 13:06
Show Gist options
  • Save guich-wo/c3137a52a371cacc58aac282893766f7 to your computer and use it in GitHub Desktop.
Save guich-wo/c3137a52a371cacc58aac282893766f7 to your computer and use it in GitHub Desktop.
Applescript to highlight ruby code in Pages
# Applescript to highlight ruby code in Pages
# Requirements : Pygments (http://pygments.org/languages/) : pip install Pygments
# Tutorial: https://shomeya.com/articles/screencast-how-to-add-syntax-highlighting-to-pages-and-keynote
try
set old to the clipboard as record
end try
tell application "System Events" to keystroke "c" using command down
do shell script "export LC_CTYPE=UTF-8; pbpaste | /usr/local/bin/pygmentize -l ruby -f rtf -O style=default | pbcopy -Prefer rtf"
tell application "System Events" to keystroke "v" using command down
delay 0.05
try
set the clipboard to old
end try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment