gist: 15512 Download_button fork
public
Public Clone URL: git://gist.github.com/15512.git
MarkdownLink.js
1
2
3
4
5
6
7
8
9
10
11
12
CmdUtils.CreateCommand({
  name: "mdlink",
  takes: {"search term": noun_arb_text},
  preview: "Replaces the selected text with a Markdown link to the first Google result for that text.",
  execute: function( theText ) {
    var baseUrl = "http://ajax.googleapis.com/ajax/services/search/web";
    var params = {v: "1.0", q: theText.text};
    jQuery.getJSON( baseUrl, params, function( results ) {
      CmdUtils.setSelection( "[" + theText.text + "](" + results.responseData.results[0].url + ")" );
    })
  }
});

Owner

arnar

Revisions