Jump to content

Syntax highlighting workflow with Pygments


Recommended Posts

I built a workflow that applies syntax highlighting to the text in the clipboard. By default, it performs RTF-based highlighting and stores the output in the clipboard as rich text so that the colorized content can be pasted into applications like Keynote and Evernote. The workflow uses a script filter to let you select the programming language. It's totally self contained, using the Pygments library which is bundled in the workflow. You can easily customize the script to change the output format (to HTML, for example) or pick a different Pygments color scheme.

 

You can download the workflow here: http://seg.phault.net/alfred/Highlighter.alfredworkflow

I wrote a blog post about it here: http://blog.phault.net/2013/12/slide-deck-syntax-highlighting-made-easy-with-alfred/

 

This is an example of a Keynote slide where I used the workflow for highlighting:

 

synhighlight-2-800x596.png

Link to comment

Hello Segphaul,

 

this look really cool.

unfortunately, I can't make it to work

Do I need some python library install to make it work ? Like installing pygments?

 

Am I the only one for whom this does not work out of the box ?

 

O.

Link to comment
  • 2 weeks later...

Hmm. I'm not sure why it wouldn't just work... it has worked out of the box on all three of my computers. :-/ The AppKit Python module comes from PyObjC, which I think has been standard on OS X since 10.5. Pygments is bundled with the workflow, so that shouldn't be a problem either.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...