chrisgo / copy-syntax-highlight-osx

Copy Syntax Highlight for OS X is an OS X service which copies the selected text to the clipboard, with proper syntax highlighting for the given language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copy Syntax Highlight for OS X

Copy Syntax Highlight for OS X is an OS X service which copies the selected text to the clipboard, with proper syntax highlighting for the given language.

Usage

The intended primary use case is to Paste the copied syntax highlighted-text into productivity applications such as Word, Keynote, and Photoshop, while keeping the code highlighting intact. Such highlighting can then be used in documents for publication and presentations for more spark, so to speak.

To use the tool, install the the pygments Python package. Then download the Service from this repository and install. On any text in any application, select the text and context-click, and the "Copy Syntax Highlight" menu item will be available. A prompt will appear asking for the language to lex the syntax highlight.

A Dark theme is also available, intended for code text to be placed on dark backgrounds.

Theming

The Service is separated into two themes: the normal theme (which uses the pygments default style), and the dark theme (which uses the pygments monokai style). To change the style used, open the service in Automator and change the corresponding style in the Get Specified Text action.

Author/Maintainer

Max Woolf (@minimaxir)

Credits

Idea was inspired by comments on this GitHub Gist, which linked to this Stack Overflow answer which serves as the core function.

Example GIF uses code sourced from learnpython.org. GIFs are rendered using the Video to GIF OS X tool.

License

MIT

About

Copy Syntax Highlight for OS X is an OS X service which copies the selected text to the clipboard, with proper syntax highlighting for the given language.

License:MIT License