✪ img
Insert image

Script key: Insert image

Posted by @gravicle

Install

Details

Label ✪ img
Voice Over Insert image
Script
// Create Markdown image link

var sel = getSelectedText();
var selRange = getSelectedRange();
var url = getClipboard();

if (!sel || sel.length == 0) {
  setSelectedText("![]()");
  setSelectedRange(selRange[0]+4,0);
  setSelectedText(url);
  setSelectedRange(selRange[0]+2,0);
}
else {
  setSelectedText("!["+sel+"]()");
  setSelectedRange(selRange[0]+selRange[1]+4,0);
  setSelectedText(url);
  setSelectedRange(selRange[0]+selRange[1]+4+url.length+1,0);
}

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus