SearchLink: Markdown Links Without The Browser

I don’t know how Brett Terpstra finds the time to do everything he does, but I do know I enjoy the results.

Brett’s latest effort is SearchLink, a system Service to generate Markdown links automatically for a variety of web services. In Brett’s words:

SearchLink is a System Service for OS X that handles searching multiple sources and automatically generating Markdown links for text. It allows you to just write, marking things to link as you go. When you’re done, you run it on the document and — if your queries were good — have your links generated automatically without ever opening a browser.

Essentially, SearchLink is a Ruby script that, in the background, generates valid Markdown for inline links inserted in plain text. These can be links pointing to a Google search, a Mac App Store or iTunes search, last.fm, Wikipedia, and more. Instead of having to switch to the browser when you’re writing, you can just write using SearchLink’s simple syntax. Once you’re done, run the Service, and SearchLink will contact web APIs to transform your text into the first/best result for your query, formatted in Markdown.

In actual usage, it means you’ll be going from something like this:

This is a [test iTunes link](!itu "Temple Run")

to

This is a [test iTunes link](https://itunes.apple.com/us/app/temple-run/id420009108?mt=8&uo=4&partnerId=30&siteID=FppfamX*gDg "Temple Run")

by just hitting a button. To generate that iTunes link, you won’t actually have to open iTunes, search for an app, and manually copy the link. SearchLink will automatically find the best match for “Temple Run” and generate a link (optionally affiliate) for you.

The syntax is the same (!argument + “query”) for every “command” supported by SearchLink. Brett has posted a list of the web services initially supported:

Software

  • !mas : search Mac App Store
  • !masd : search Mac App Store, return seller URL
  • !itu : search iTunes App Store
  • !itud : search iTunes App Store, return seller URL
  • !s : software search using Google

General

  • !g : first Google result

Terminology

  • !wiki : Wikipedia link (Wikipedia API)
  • !def : Dictionary link/fallback to Wikipedia (DDG API)

Music

  • !isong : iTunes song link
  • !iart : iTunes artist link
  • !ialb : iTunes album link
  • !lsong : Last.fm song link
  • !lart : Last.fm artist link

Additionally, any !address recognized as a url will become a site-specific search for the link text (or specified search terms). Try using [MacStories](!macstories.net "OmniFocus"), for instance, and you’ll get the first result from our DuckDuckGo search: the OmniFocus tag.

For me, SearchLink is a huge timesaver. I write my articles in Markdown, and 30% the time spent composing them is related to browsing around to find links and hyperlink titles. I have set up AppleScripts and Keyboard Maestro macros to automate the process of inserting links, but those utilities don’t eliminate the main problem: finding links.

SearchLink cuts that step entirely. Sure, you’ll have to provide accurate queries to get the best match from all possible results (as I asked Brett in a tweet), but once you get the hang of it, the minutes you’ll save with this script will quickly add up. With support for generating iTunes affiliate links, for instance, I’ll save a lot of time otherwise spent opening iTunes, watching it bring up a beachball, find an app, and copy its link.

SearchLink is provided as a system Service you can install by double-clicking on it. Once installed, select some text, choose the Service from the right-click menu, and SearchLink will do its conversion inline with the document. To simplify the process of entering SearchLink-friendly Markdown, however, I’ve assembled a quick Keyboard Maestro macro. It’s based on the “Link New” macro of the Keyboard Maestro Markdown Library, and it works with the way I add links: select some text, enter the source (Google, iTunes) and your query (ie. “angry birds space”), and hit Return. You can probably make this work with a text snippet instead of a keyboard shortcut, or by accepting any text input and not just selected text.

As for the Service, don’t forget you can also assign keyboard shortcuts to them using the built-in OS X Services menu. Open System Preferences, choose Keyboard > Keyboard Shortcuts, then Services > Text, and assign a shortcut to SearchLink. In a document, select some text and hit the shortcut.

Looking forward to future SearchLink improvements (I’ll find a way to make this work on iOS, somehow), check out the first version over at Brett’s website.

Access Extra Content and Perks

Founded in 2015, Club MacStories has delivered exclusive content every week for nearly a decade.

What started with weekly and monthly email newsletters has blossomed into a family of memberships designed every MacStories fan.

Learn more here and from our Club FAQs.

Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with apps, tips, automation workflows, longform writing, early access to the MacStories Unwind podcast, periodic giveaways, and more;

Club MacStories+: Everything that Club MacStories offers, plus an active Discord community, advanced search and custom RSS features for exploring the Club’s entire back catalog, bonus columns, and dozens of app discounts;

Club Premier: All of the above and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.