Quickly Insert Links in your Markdown Documents with Brett Terpstra’s SearchLink — Our Partner of the Month

Hook is great for quickly copying and using links to almost anything. But what if you often need to insert links in your Markdown documents to webpages that you haven’t even visited yet? Or, you’ve bookmarked something (in Hook or a web browser) and want to insert a link to it directly in your Markdown document without interacting with a search engine and without manually searching your bookmarks. What do you do?

Well, Brett Terpstra’s SearchLink has you covered! Under the hood, SearchLink leverages web search engines, or Hook (with which it now integrates), to look up the URL of the text you’ve typed and selected. This works well on the assumption that the top search result is what you want; and that assumption is typically correct!

Here’s how to use SearchLink, once you’ve installed it. Suppose you are writing a document in Markdown and want to link to the SearchLink web page in your document.

  1. In your Markdown document, you might then write Brett Terpstra’s SearchLink. You’d then
  2. select the text you just wrote (Brett Terpstra’s SearchLink); and
  3. invoke SearchLink, using the Services menu or a keyboard shortcut. That’s it!

Under the hood, SearchLink will perform a web search with that selection (of step 2). That, in turn, would happily find the right URL, https://brettterpstra.com/projects/searchlink`. SearchLink would then wrap the selection (again, from step 2) into a complete Markdown link:Brett Terpstra’s SearchLink`. That of course can be previewed as Brett Terpstra’s SearchLink.

In a nutshell:

SearchLink replaces your search expression with a Markdown link to the URL found by SearchLink. SearchLink saves you the trouble of going to a web browser (or other search tool), clicking on the search result, getting the URL, copying the URL, and creating a well-formed Markdown link with it.

Who should care?

Anyone who writes a lot in Markdown, and who references material with links, should care. And since Markdown is one of the most convenient ways to write hypertext, basically almost every knowledge-oriented person should care. That means anyone who uses Hook or reads my Cognitive Productivity books should care 😉.

SearchLink integrates with Hook!

I was delighted to learn on Twitter last month that Brett Terpstra extended SearchLink, making it work with Hook! On his blog, he published Hook and SearchLink.

This means that you can use SearchLink to find anything that Hook has automatically bookmarked for you. Whenever you Copy Link, Copy Markdown Link, or hook things together with the menu bar icon, Hook adds a bookmark. As you know, Hook can not only bookmark web pages, it can bookmark anything that has a URL: files, emails, tasks, agenda:// items, x-devonthink-item items, nvUltra:// items, … you name it!

That means Hook Pro users can use SearchLink to insert links to anything! For example, I recently received an email about version 4 of OpenIn which is in beta. OpenIn is a Mac app that allows you to choose the app with which to open URLs. I wanted to reference the email in my notes; so I typed:

[OpenIn v4 Beta](!hook)

The !hook imperative tells SearchLink to use Hook as the search engine. When I expanded that selection with SearchLink it returned:

OpenIn v4 Beta

which is exactly what I wanted. Of course, I could have used Hook to look up the email and do Copy Markdown Link.

NB: While learning about SearchLink’s Hook integration, I discovered an issue in Hook’s AppleScript API. If you’ve renamed a bookmark in Hook, SearchLink won’t find it. That will be fixed in the next release of Hook.

Check out SearchLink on Brett’s website

Although SearchLink is conceptually simple, it’s hard to succinctly convey just how useful it is. It’s a tool you have to try. So check out Brett Terpstra’s SearchLink. You’ll see that Brett has plenty of documentation. And as you’d expect from Brett Terpstra, the software is very configurable and completely plain-text friendly.

SearchLink: Partner of the Month for September!

For over a decade, I’ve been relying on Brett Terpstra’s Markdown-related software every work day — whether it be his Marked, nvALT apps or more recently nvUltra; or other tools Brett has created. For example, in nvUltra, I take my ‘scratch’ notes that sync to iPhone and iPad via iCloud. I preview every Markdown file I write (including this blog post) in nvUltra.

Brett has also published an enormous amount of useful Mac software information that has informed and inspired me.

Most of what Brett has created over the years is free — donate what you want. SearchLink fits that mold. And of course, SearchLink saves you time and effort with links.

Hook users understand that clicking links is faster than searching. It keeps them in the zone.

So, it is quite fitting that SearchLink is our “Partner of the Month” of September, 2002, which is now!