I\'m trying to do something similar with stack overflow\'s rich text editor. Given this text:
[Text Example][1] [1][http://www.example.com]
I
This format is based on Markdown. There are several JavaScript ports available. If you don't want the whole syntax, then I recommend stealing the portions related to links.