MACRO: The Link Creator - Create Markdown or HTML links on the fly

A couple years back, I posted a simple macro called Yet Another Link Creator, which would take a URL on the clipboard and turn it into HTML markup.

It worked reasonably well, but it would occasionally freak out (now I know why). In addition, it dealt solely with HTML links, because I wrote very little Markdown. I still don't write a ton of Markdown, except here on the forums, where I do it a lot.

So I decided to revisit that macro to fix the issues and add Markdown support—and to let the user decide between HTML and Markdown as the default mode. The end result is here now: The Link Creator. Before I explain how it works and how to use it, here's how it looks in action:

An animated GIF hides within

link_creator

And here's the macro.

Download Macro(s): The Link Creator.kmmacros (53 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.4.1
  • Keyboard Maestro v11.0.2

As you can see in the GIF, the macro pastes formatted http(s) links (in either HTML or Markdown) in one of three ways, which are actually easier to explain with a screenshot (the forum turns the link examples into real links) from the macro's Read Me First:

(There is a fourth mode: If you have text selected but no link on the clipboard, then the macro simply exits, so you don't lose your selection.)

And because I know there are people—@_jims, I'm looking at you!—who prefer Markdown to HTML, the macro lets you decide which format is the default (no Shift key required) and which format is optional, just by changing the value of one variable. (It is, of course, set to use HTML as the default :)).

Note that this macro is not a replacement for @_jims excellent Markdown Link Tool, as that's focused on inserting links (in various forms) from a list of known URLs. I still use that one (well, my much-less-fancy HTML-only version of that one) every day.

But I use this macro probably at least as often, as it seems (more and more) I'm linking to sites that aren't on my "often linked" list. And—gasp—doing so more often in Markdown, as I did a few times in writing this post :).

If you paste a lot of links in HTML and/or Markdown, it can be a big timesaver. There's a decently-detailed Read Me in the macro, but let me know if you have any questions.

-rob.

2 Likes