Another MarkDown Service

AppleScript

AppleScript (Photo credit: Wikipedia)

 

I found myself writing another Service. Once again it replicates one of Brett Terpstra’s. This one takes a currently selected HTML link or list of links and reformats them as MarkDown, if it’s a list it returns the MarkDown links as an unordered list. I also have a version that works on the clipboard that I am using with the “Copy All URLs” extension to Chrome.

This leads me to the question of why I bother to write these rather than use Brett’s. One is just that I enjoy writing them despite having to do it in AppleScript. Second is that it keeps my AppleScript skills up. Finally it means I have the source code.

I’m adding a bunch of Services and keyboard shortcuts so I’m using KeyRemap4MacBook and PCKeyboardHack with Keyboard Maestro as well as setting the shortcut for Services in the KeyBoard pane of System Preferences. I use the method Steve Losh talks about in this post. This allows me to set keyboard shortcuts for my Services such as Shift-Option-Command-Control L.

Well, back to the new Services. URL2Link takes the current selection and returns either a single MarkDown link or an unordered list of them if you pass it a list of links. Clip2Link does the same thing but uses a link or links on the clipboard as source. Due to the strangeness of Services you will still need a piece of text selected ad it will be replaced.

Once again, drop them in ~LibraryServices and set the keyboard shortcut in the Keyboard System Preference or use the control click menu to run them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s