App icon 1Writer

New Linked

Shared by viticci

Reformats Markdown captured by the 1Writer extension to copy the original source URL to the clipboard. Best used for linked posts on blogs. Designed to be used in the 1Writer extension.

Script

var re = /!?\[([^\]]+)\]\(([^\s]+)(\s"[^\)]*")?\)/g;

text = editor.getText()

match = re.exec(text)

title = match[1]
url = match[2]

if (app.inExtension()) {
	final = text.replace(match[0] + '\n', "")
    editor.setText(final)
	app.setClipboard(url)
	editor.close()
}