-
-
Save willwm/9543773e6cac691ef3eb9c2e1ddeb05a to your computer and use it in GitHub Desktop.
Bookmarklet for markdown link of current page (incl. optional selected text as quote)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function() { | |
const selection = window.getSelection().toString(), | |
title = document.title, | |
link = `[${selection || title}](${location.href})`, | |
markdown = `${link}`; | |
void prompt(`${title}\n${location.href}`, markdown); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Atlassian Link Style | |
javascript: (function() { | |
const selection = window.getSelection().toString(), | |
title = document.title.replace('[', '\\[').replace(']', '\\]').replace('|', '-'), | |
link = `[${selection || title}|${location.href}]`, | |
markdown = `${link}`; | |
console.log(markdown); | |
void prompt(`${title}\n${link}`, markdown); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment