I use Python-Markdown to render user generated content. I'd like to change pictures from external sources to links.
So i have a list of storages:
storages = ['foo.com', 'bar.net']
and i need to replace

to something like:
[http://external.com/image.png](http://external.com/image.png)
if host not in storages.
I tried to edit markdown-text before saving to database but it's not good solution as user may want to edit his data and discover data was modified. So i want to do that replacement on render.
One solution to your question is demonstrated in this tutorial:
Testing it out:
Full disclosure: I am the lead developer of Python-Markdown. We needed another tutorial which demonstrated some additional features of the extension API. I saw this question and thought it would make a good candidate. Therefore, I wrote up the tutorial, which steps through the development process to end up with the result above. Thank you for the inspiration.