I will add that the site Bookmarklets for Stack Exchange contains several useful bookmarklets. The one called "Formatted link to a webpage" is useful exactly for situation like this - if you want quickly get a link to the current page formatted in the [text](url)
format which is suitable both for comments and for posts on Stack Exchange.
For example, if I use it on this question I get: [Use this userscript when you share a link](https://physics.meta.stackexchange.com/q/7232)
If I use if after I clicked on a link to this answer, I get: [Use this userscript when you share a link](https://physics.meta.stackexchange.com/q/7232#10702)
. Both links are correctly rendered in posts/comments Use this userscript when you share a link and Use this userscript when you share a link.
Just in case the linked website stops working at some point in the future, here is the source of the bookmarklet and also Internet Archive link.
t=window.getSelection().toString();
if (!t && document.querySelector('h1')) {
t=document.querySelector('h1').textContent.replace(/ \[closed\]| \[on hold\]| \[duplicate\]/g,'').trim();
}
else if (!t) {
t=document.title.split('-')[0].trim();
}
u=window.location.href;
if (typeof StackExchange!=='undefined' && u.indexOf('area51')==-1 && /^[qa]/.test(u.split('/')[3])) {
u=window.location.protocol+'//'+window.location.hostname+'/q/'+window.location.pathname.split('/')[2]+window.location.hash;
}
window.prompt('Copy to Clipboard','['+t+']('+u+')');
[title](url)
links because I either have to hover to check the url or click on the link to find out where it leads. Leaving it asurl
shows exactly where you're being taken (though a mischievous person could type[fake PSE url](real url)
and take you elsewhere...) $\endgroup$ – Kyle Kanos Nov 16 '15 at 19:25