1

I want to create a rich text hyperlink out of an url, which is then pasted as working link. In other words I want to create some sort of behaviour like in this example:

  1. On stackoverflow copy the tag catgory python
  2. Paste it in Microsoft Word

The result is a richt text hyperlink in word, which displays pyhton and if I click on the hyperlink it opens up the url https://stackoverflow.com/questions/tagged/python

screencapture of richt text hyperlink

In Javascript this can be done, somehow like described in 1933185

For pyhton I have found the module rich where you can achive this in a terminal, like describe in real-working-hyperlinks-in-the-terminal-with-rich. But I think this is the wrong approach for me.

The modules pyclip and pyperclip c'ant handle rich-text.

The basic idea is (done in python):

  1. Take a Url, like: https://stackoverflow.com/questions/tagged/python
  2. Create a hyperlink out of it: <a href="https://stackoverflow.com/questions/tagged/python">python</a>
  3. Convert this to a rich-text-hyperlink: python
  4. Copy & paste the richt-text-hyperlink

The steps 1 and 2 are clear, but I struggle on step 3 and 4.

How can I create a rich-text-hyperlink in pyhton which can be pasted?

jerik
  • 5,714
  • 8
  • 41
  • 80

0 Answers0