“Hello World”, this is just another post about one tiny tiny Keyboard Maestro macro.
I’m currently in the process of converting some lists from one format into another. This macro helps me speed up the process. It takes a Markdown list that has asterisks or hyphens as list markers and depending on which one it finds in the selected text switches to the other one. All indentation is kept.
- Adam Buxton
- Great YouTube Video
- ♥ of my dog
… becomes this:
* Adam Buxton
* Great YouTube Video
* ♥ of my dog
You might wonder how one could possibly need such a script if Markdown doesn’t differentiate between the list markers. Well, this becomes useful if you use apps like Listacular or any other app that has a feature which treats the list markers differently (there are quite a few)1.
This is the macro:
The only magic that is happening is an regular expression which went from this mess (picture) into this
([\t ]*)\*(.*) concise beauty (thanks to the clever folks at the Stack Exchange community).
PS: If you want to switch list markers on the whole document instead of just the selection add a type action with the
⌘A shortcut as the first action in the macro chain.