Skip to content

Instantly share code, notes, and snippets.

@hirohitokato
Created January 1, 2018 13:49
Show Gist options
  • Save hirohitokato/c1a0e631d688ce94c5d157862c0c0cb0 to your computer and use it in GitHub Desktop.
Save hirohitokato/c1a0e631d688ce94c5d157862c0c0cb0 to your computer and use it in GitHub Desktop.
A bookmarklet to get a markdown style URL string you are seeing, whose title is the page title or a string you select. The result is copied to clipboard.
javascript:caption=window.getSelection()+'';if(caption==""){caption=document.title;}i=document.createElement('input');i.setAttribute('id','copyinput');document.body.appendChild(i);i.value='%5B'+caption+'%5D('+location.href+')';i.select();document.execCommand('copy');document.body.removeChild(i);void(0);
// execute the bookmarklet without selection: [page's title](page URL)
// execute it with selection: [selected string](page URL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment