Copy selected link(s) from browser as markdown?

I had a quick look - they are using this:

So the cursor is selecting an element in a special rich text control, which is not accessible in the same way.

Thanks. So does that mean the html hyperlink is not accessible via JavaScript running in KM?

I think you would need to study how they take over events in that proprietary control, and any automation you achieved would be specific to it – doesn’t sound like a good investment of time for you.

( Probably better to frame a feature request and send it to them )

I think I can get the HREF via the brute force method I’ve used before:
Copy the selection, unpack the Clipboard to get HTML, and extract the HREF via RegEx.

I was just hoping there was a more elegant JavaScript approach.

Rob, does this macro have you latest JavaScript code to get hyperlink properties from selection?

When I use it on this page:

Selecting this topic (or any topic really):

It returns this:

There's obviously a lot of extra white space in the result.
It should have just been: "Freeing up Data"

I'd like to update some of my macros where I use the clipboard and RegEx to get the link properties to just using JavaScript. But I've got to make sure the JavaScript solution will work in almost all cases. So far my brute force solution has not failed.

But it's beginning to look like if the HTML anchor in anything other than a plain anchor, if it is embedded in other code, then the JavaScript solution may fail.

Your thoughts/ideas?

Rob, I had another thought.

In any Browser, if you right-click on hyperlinked text, you can choose “Copy Link Address”, and it copies the URL.
Is there a way to call this from JavaScript for selected text?

Not sure that that evades the problem, which is simply the difficulty of generalising references to selected nodes when special controls like RTF editors are being used.

I'm not sure I understand your comment. All of the RTF apps I use support the right-click "Copy Link Address". Is there a way, in KM or JavaScript, to execute the "Copy LInk Address" function that is exposed in the right-click menu?

The difficulty is in getting a predictable route to in the standard JavaScript domain model, once non-standard techniques are being used.