Forum Archive

MD links from URL:s in document with rest of text intact

Niklas

Hi!

Has anyone made a workflow that replaces all URL:s in a document with markdown links, with URL titles as titles, and leaves rest of document text untouched?

Best regards, Niklas Johansson

omz

Wouldn't that be the same as the workflow in this thread?

Niklas

Not quite. That one extracts all links from a text and makes it a nice list. I am looking for one that just replaces URL:s with MD links and leaves the rest of the text intact.

Best regards, Niklas

omz

I see. Here's a simple Python script for replacing plain URLs with links:

http://www.editorial-workflows.com/workflow/5836041357361152/KGL46smq0Is

Note that this will only work properly if you don't have actual links in your document (because it would replace the link URLs as well, the regex would need to be a bit more complex to distinguish links from plain URLs).

Also, in some cases, retrieving the titles via Mechanize doesn't work (some sites don't like to be scraped). In that case, the title remains empty, and an error is logged to the console.

aanchal

LEO PRIVACY GUARD 3.0 How to change / reset password?
Please find Settings in home page at the top right corner, go to "Change Password", you can change or reset your password.

Niklas

Yes, that's exactly what I wanted. Thank you very much for your help! :-)