If you add to the link #:~:text= and then the text (with URL encoding, obviously, so spaces turned to + and other fancy characters percent encoded) then it will highlight the desired text. For example:
This is great. Chrome has a native right-click option to make a link to highlighted texted but Safari does not. So, I was opening Chrome just to do that. With this trick and a Macro to implement it, I can now make the link while staying in Safari. Thanks for sharing @peternlewis
Macros are always disabled when imported into the Keyboard Maestro Editor.
The user must ensure the macro is enabled.
The user must also ensure the macro's parent macro-group is enabled.
System information
macOS 14.7
Keyboard Maestro v11.0.3
Select some text on a KM wiki page, press Control-F, and get a highlighted link on the clipboard, ready for pasting. Don't want it highlighted? Press Control-Option-F.
Perhaps useful as a starting point for something else.
Actually, the parameter has additional facilities to specify the (unmarked) prefix and postfix so it is usually possible to highlight more specific locations.
Ah, that's interesting. I have found that as I'm selecting sentences and paragraphs there hasn't been a problem with highlighting the wrong text.
Also, in that same article you linked to it mentions that highlighted text links are coming to Safari as a native feature. Using the hint you shared to link to that