---
title: Markdown link format conversion on iOS
date: 2012-10-17 13:33
slug: markdown-link-format-conversion-on-ios
categories:
- Code
tags:
- ios
- markdown
- scripting
- texteditor
---

I was chatting with [Gabe Weatherhead][1] yesterday about turning [SearchLink][2] into a Python script that could then run on [Pythonista][3]. That would allow you to copy text from an iOS editor, open Pythonista and run the script, then go back to your editor and paste with your links converted. I'm not sure it's going to be possible, yet, because I don't know how iOS and Pythonista handle network connections from scripts. I have a lot to learn.

[1]: http://macdrifter.com/ "Macdrifter"
[2]: http://brettterpstra.com/searchlink-automated-markdown-linking-improved/ "SearchLink: automated Markdown linking improved - Brett Terpstra"
[3]: https://itunes.apple.com/us/app/pythonista/id528579881?mt=8&uo=4&partnerId=30&siteID=vRL5rYo4h5A "Pythonista"

That being said, it made me start thinking about turning some of my other Markdown Services into scripts I could run on my iPad and iPhone. I searched for a decent Ruby equivalent to Pythonista, but thus far haven't found anything workable. So, Python it is.

I started the experiment with an existing Python script by [Seth Brown](http://www.drbunsen.org) called [formd](https://github.com/drbunsen/formd). It's what I've been using lately to convert inline Markdown links to references, and vice versa.

I made some adjustments to the script to work with Pythonista, and made a version that takes clipboard input, runs the "flip" routine on it (flips link format depending existing links detected) and puts it back on the clipboard. Here's a [gist of my revised script](https://gist.github.com/3907181). If you have [Pythonista](https://itunes.apple.com/us/app/pythonista/id528579881?mt=8&uo=4&partnerId=30&siteID=vRL5rYo4h5A "Pythonista"), you can just paste it into a new script, copy some Markdown to your clipboard and run it. The content of your clipboard should have its link format switched between inline and reference.

I'll be trudging through converting a few more of my more useful Ruby scripts to Python now. I'm excited about the possibilities of bringing some added convenience to iOS Markdown writing, I just have to figure out what all the limitations are going to be. Time will tell.

---

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff. This content is supported by readers like you. [More about Brett](https://brettterpstra.com/contact.md), including social links.

Copyright © 2026 Brett Terpstra. All rights reserved.
