There may be other ways to achieve this, but the only way I know is to use a script, like AppleScript or JXA.
I have done something similar, putting two formats on the clipboard:
- Rich text for hyperlink
- Plain text for Markdown link
Then, when you paste into a rich text document, like Word, it will paste #1. When you paste into a plain text document (like this forum), it will paste #2.
In the script, the process is:
- Create the HTML code to format your text
- Copy this to the clipboard, and convert to Rich Text in the process
- Read the clipboard to get only the rich text
- Create a record with rich text and plain text
- Copy this record to the clipboard.
See this example:
Macro: Set Clipboard to RTF Hyperlink & Plain Text MD Link