✪ Link
Markdown link

Script key: Markdown link

Posted by @krispie

Install

Details

Label ✪ Link
Voice Over Markdown link
Script
// Create Markdown link

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

if (linkadd.substring(0,4) != "http") {
  linkadd = "";
}

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

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus