I wrote a few new PopClip extensions over the weekend. There were several features from the Markdown Service Tools that I thought would be really handy to have right after making a mouse selection.
The first one is an extension to turn lines of text into Markdown bullet items. Indentation is handled as nested lists and existing markers are overwritten (so a numbered list converts to a bullet list). I frequently type quick notes on single lines and then later add formatting, so this is already being used quite a bit on my system. It’s also handy when copying lists from websites and pasting to plain text as they lose their formatting in the process.
BulletList isn’t just for bullet lists, though. Holding option while clicking the extension in the PopClip popover will create/update a numbered list instead. If it’s run on an already-numbered list, it will update (“fix”) the ordering in the list.
This is only here if you want a separate button for numbered lists. I made it before I decided to add the option-key feature to BulletList. It does exactly the same thing as Option-clicking the BulletList extension. If that’s natural for you, don’t install the extra extension.
This one turns indented text into a nested Markdown block quote. It reads the indentation of the text and determines the level of block quoting to apply.
I really came up with creative names for these, didn’t I? This will, as you guessed, turn selected text into Markdown code. Here’s the cool part, though: if your selection is within a paragraph, it will turn it into inline code. If it’s multiple lines, it will create a code block.
When creating an inline code block, it will also detect whitespace at the beginning and end of the selection and make sure that it’s excluded from the surrounding backticks.
This one also differs from the Service Tools slightly. Instead of just moving everything out one tab or four spaces, it takes the line closest to the left edge, fully outdents it and then applies the outdent to any nested lines in the selection, maintaing indentation. It really had to be this way, as making a selection repeatedly is far less convenient than adding a shortcut to a service and hitting a hotkey a couple of times.