Zettt / km-markdown-library

Markdown library for Keyboard Maestro.
193 stars 10 forks source link

more concise way for wrapping selected text #44

Open haukelicht opened 6 years ago

haukelicht commented 6 years ago

Hello!

I love to work with your KM macros. Yet, I wonder whether your Make italic (Make bold) and Wrap ... macros could be defined more concisely.

Specifically, I'have experimented with the %|% (Location cursor) token to insert text at the current cursor location (which is where selected text is, when one wants to wrap it in *, **, etc.). I have, for example, defined an alternative action flow to wrap selected text on both ends with asterisks (*) to make it appear italic in markdown (see also attached image):

  1. Execute Macro "Helper - Is text selected?"
  2. Cut to Named Clipboard "Temporary"
  3. Insert Text "%|%%NamedClipboard%Temporary%%|%" by Pasting
  4. Set Named Clipboard to "%Delete%"

This way of making selecting text appears to be faster, since it does not involve waiting times. Are there any caveats to defining the "Make Italic" Macro in this way in your opinion?

km_macro_mardown_make_italic