Here is a method that is much simpler to create a Markdown link from a selected hyperlink, which should be much, much faster than having to retrieve the entire web page HTML source:
It uses this script, provided by @ComplexPoint in this post:
(function (oNode) {
var oLink = document.evaluate(
"./ancestor-or-self::a",
oNode,
null, 0, 0
).iterateNext();
return oLink ?
"[" + oLink.text + "](" + oLink.href + ")" :
"";
})(window.getSelection().anchorNode);