MACRO: Markdown Link Tool, v5.0

Haha, I think with just a little work you could come up with a catchy company slogan! :grinning:

2 Likes

Markdown Link Tool has been updated to Version 2.0.

  • When pasting, if the current object selected can render rich text, the link will be entered as Rich Text; otherwise, Plain Text. When the Clipboard option is selected, the macro will populate the Clipboard with both variants, Rich Text and Plain Text. The Clipboard can subsequently be pasted based on the context of any selected object. This context sensitivity, when pasting and with the Clipboard, is thanks to a JXA script provided by @ComplexPoint.

  • Added a few Keyboard Maestro Wiki entries—MarkdownLinks Default 2; added a few more examples—MarkdownLinks User.

  • Made several refinements to dialog text, messages, and macro comments.

Markdown Link Tool has been updated to Version 2.1.

  • Updated parsing of text lists.
  • Other changes to increase macro speed.

HTML <a> tags ought to work in Markdown. So you could continue to use them.

I say that as a big fan of Markdown.

I wouldn't want to maintain a document that someone had written in HTML. I do maintain documents collaboratively written with others in Markdown. (Not least presentations written in it and put through mdpre/md2pptx.)

Martin:

I don't write with others, I don't maintain documents written by others, and I have zero interest or need to use Markdown. My HTML writing is directly in blog posts, for web pages, or for KM macros, and I'm 100% comfortable using HTML in those situations.

For me, it makes no sense to work with a subset of the entire language, in a different dialect as it were, when I can just use the language itself. I know that's not true of others, and I know many rely on Markdown to make it much easier to work on shared documents with people who don't know HTML. None of that applies to me, though.

-rob.

1 Like

@_jims I just came across this and at first thought I wouldn’t have any use for it. I was wrong!

I just downloaded it and immediately saw its utility. I made one adjustment that makes it a little easier to use this on multiple computers. I have the variables populated from text files saved in my Dropbox that way I don't have to worry about updating the variables in KM Editor on each device. This way I can just edit the text files when I want to make updates to my list.

Thanks again for sharing!

Hi @cdthomer. Glad you find it useful.

So far, I've been using it primarily when participating on forums—and lately this has been my favorite one. :grinning:

if you are doing the same, you might also find this macro useful: Augment or Filter Text

Nice enhancement—thanks for sharing! I'll likely make a similar change on my personal copy (I'll use iCloud Drive, however), but as you likely know, a feature that includes interaction with the file system introduces some implementation friction for newcomers, particularly when Dropbox is introduced. On the other hand, pros like you can easily make an enhancement like you have shared.

With that said, I'll give this some more thought. Maybe I could make it an option to use files.

Thanks again, for sharing your feedback.

If you haven't done it already, you could modify the Edit Me logic to open the folder that contains these files.

On this particular detail, you might want to check out Log It. With that macro, there's an option to open and enclosing folder or a specific file. The revised Edit Me could open the folder or optionally open the file associated with the MarkdownLinks User variable.


Responding to feedback by @cdthomer, I've updated Markdown Link Tool to Version 3.0.

  • Moved Markdown Links from text variables to configuration files: 0 Favorites.md; 8 Keyboard Maestro Forum.md; 9 Keyboard Maestro.md. Other md files can be optionally added to the same folder. Added options to: 1) navigate to the configuration folder, 2) open the configuration files, 3) Prepend to or Append to a Markdown Link in the clipboard to the configuration files.

  • Changed the primary trigger from ⌥⇧L to ⌥⇧M. Added a secondary trigger (⌃⌥⇧M) to provide direct access to the configuration files.

1 Like

This is great Jim, I have really come to like this macro and it has become one of my most frequently used ones throughout my day.

Question: when I made those modifications to my personal copy I saved the files as txt files, what are the advantages to using md files?

EDIT: a followup! I made a slight modification to this portion of the macro to automatically populate the Text field with the front window's name... because I am that lazy :laughing:

1 Like

Thanks, @cdthomer. I appreciate the feedback. Glad you find this macro useful.

Many text editors (e.g., BBEdit) will apply proper Markdown syntax coloring/highlighting for files with an md extension.

That's a great idea, but when testing with Safari, I've noticed an issue. If I go to the search/URL bar (using File > Open Location—⌘L), then Copy—⌘C, and run the macro %WindowName%1% is empty (at least, most of the time). However, if I click onto the body of the web page after ⌘C and run then macro, %WindowName%1% includes the web page title. I do not see this same issue with Chrome.

After discovering this issue, I replaced %WindowName%1% with %SafariTitle% and that seems to be populated as expected. So my questions to you, @cdthomer :

  • Did you add %WindowName%1% to get a web page title?
  • If yes, what browser have you been using?

Based on you suggestion and my testing, here's what I'm thinking of adding to the next version:

Proposed modification-image

Keyboard Maestro Export


Also, as I was working through this, if the URL is empty and Safari or Chrome is running, I was thinking, why not I prompt to populate with one, the other, or both of the following:

  • [%SafariTitle%][%SafariURL%]
  • [%ChromeTitle%][%ChromeURL%]

So considering your feedback and this addition, here's how the whole section would change:

Macro section-image

Whew, that's a lot of work to get one Markdown link!

After I hear back from you, @cdthomer, I'll share an updated version of the macro.

Hey Jim, yes I used %WindowName%1% to get the title, and I noticed the same issue on occasion.
I use Safari only.

I like the changes you proposed! I’ll keep an eye out for the update!

@cdthomer, thanks for the quick reply.

I've been continuing to test since my previous post. Even though it seems to work, it can be slow under some circumstances and I'm not keen on the complexity that it adds.

Here's an alternative approach that I'm strongly considering for the next version:

Alternative approach-image

1 Like

Hello @_jims, How are you creating these nice GIF demos? I'm using free LiceCAP, but it doesn't show the keyboard shortcuts ...

1 Like

I’m curious too how he’s able to screen record the entire screen and not have the file be so large that it can’t be uploaded :sweat_smile:

Hi @ALYB and @cdthomer. Great questions. I wish I had a nice, simple, and fast process I could share, but unfortunately I don't.

Before I get into the specifics, allow me to step back. With macros here (and with iOS shortcuts elsewhere) I've supplemented my forum posts in three ways:

  1. Screenshots

  2. Screencasts uploaded to YouTube and referenced in a post. Some forums allow YouTube embedding, others don't. I can't remember if I've tried embedding on this forum. But I have included links to YouTube videos. Here are two that immediately come to mind:

    a. Log It—Quickly Save Plain Text Snippets to One or More Log Files : youtu.be/Zp-8BHhxPLY

    b. Augment or Filter Text : https://youtu.be/Yvnwopo6fio

  3. GIF Animations (like above)

As I'm sure you know, screenshots are simple and fast. I'm a Setapp subscriber so I use CleanShot X. When I worked at a F50 company and was forced to use Windows, I used Snagit. There is a version of Snagit for macOS, but I've never tried it.

Also, as I'm sure you know, for screencasts and GIF Animations, the time and effort is a huge step change up. For a few of my macro (and iOS shortcuts) posts, I've spent more time on the screencast than on the macro/shortcut. :frowning:

When I do decide to use a screencast or GIF animation, I start with ScreenFlow. I do some independent consulting and purchased it for that work, so I've been able to absorb the $150 initial cost and $50 upgrade fees.

ScreenFlow is okay, but I'm not a huge fan. It does, however, have a Show Keystrokes feature with two options: 1) Show all keys, 2) Show only modifier keys.

I've found that the Show Keystrokes feature is far from flawless: more than once I've had to repeat a recording session. Also, since keys are never pressed exactly simultaneously, combinations like ⌃⌘C are normally recorded on the timeline in a sequence something like this:

 ⌃ ... ⌃⌘ ... ⌃⌘ ... ⌃⌘C ... ⌃⌘C ... ⌃⌘C ... ⌃⌘C ... ⌃⌘ ... ⌃⌘ ... ⌘ 

Since all sequences except ⌃⌘C are distracting within screencast, I split the recording into clips and selectively disable Show Keystrokes for the clips that include the subsets of the ⌃⌘C. (I hope that makes sense.) This process is tedious and IMO the Show Keystrokes feature has some room for improvement (e.g., maybe time thresholds could be added to avoid the key combination subsets).

I've converted some of my shorter MP4 recordings to GIF animations using gifski. To keep the final GIFs small I reduce the frame rate (to a value that still looks decent), but the biggest factor seems to be the recording dimensions. For the GIF above, I set my 16" MBPro to 1152x720 before starting the ScreeFlow recording session.

I hope that helps. This topic probably merits a separate thread as I'm sure others have more insight than me. I'd certainly love to learn about a process that is simpler.

2 Likes


After discussions with @cdthomer, I've updated Markdown Link Tool.

Version 3.2

When potentially updating a configuration file with the Clipboard contents, if a Markdown Link is not found, this macro executes the macro Copy as Markdown Link. This macro can build a Markdown Link to browser pages and elements for many other applications.

1 Like

I've updated the OP with Version 3.3 of Markdown Link Tool:

  • Added several new markdown links to the configuration files. This macro now includes 150+ links.
  • Corrected a few typographical errors within comments and one within a dialog.
  • Updated the information in TESTED WITH.
2 Likes

Hello @_jims @ComplexPoint @cdthomer,

I am very grateful for this macro which I use a lot. I am working on a mind map using Simple Mind.

When I try to copy the markdown link, I see the error message below. How could I write a macro to add simple mind to the library of markdown list macros ?

Thanks very much!

2 Likes

I don't use SimpleMind myself, but looking at the Trial version, I see that its menu paths include:

Edit > Link Topic > Copy Link to Topic

Does that seem to work ? Here, I may have misread its function, or there may be a limitation imposed on the trial.

If that menu path does, in fact, capture a url for a selected node, then you can get the label for a node with a simple Edit > Copy and assemble a submacro, using successive clipboard contents, along the lines of others in:

RobTrew/copy-as-md-link: macOS Keyboard Maestro macro group

but with:

  • the name com.modelmakertools.simplemindosx
  • and code which:
    • just assigns a value to the KM variable mdLink
      (in the form of a [label](url) string)
    • assembled by script or KM blocks in the manner that you will see in other sub-macros in the copy-as-md-link group.

It's not clear to me, however, (after a cursory search) whether SimpleMind actually supports its own url-scheme, and it also looks as if there may be some sandboxing limitations on link-navigation if you have the AppStore version.

See the asterisked footnote at the bottom of:

Navigation link (to a file, topic, contact or the web) - SimpleMind

https://simplemind.eu/faq/navigation-link/

2 Likes

OK. All clear. thanks very much !