Editorial Workflows

URL to Markdown Link

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: This action makes a link in Markdown from a selected URL.

The link’s text is the Title of the page fetched from the URL.

For example:

http://dobyfriday.com

Becomes:

[Do By Friday](http://dobyfriday.com)

Shared by: @macdhuibh

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
Run Python Script ?
Source Code
#coding: utf-8

import re
from HTMLParser import HTMLParser
import requests
import workflow

title = ''
url = workflow.get_input()

if url.startswith('http'):
  page = requests.get(url)
  pattern = re.compile(r'<title>.*\s*.*\s*<\/title>')
  title = pattern.findall(page.text)
	

if title:
	title = title[0]
	html = HTMLParser()
	title = html.unescape(title)

link = "[{}]({})".format(title, url)

workflow.set_output(link)
Replace Selected Text ?
Replacement Text
Input