Your work is interesting and sure looks like good ruby to me. I had to write a similar parser for Zena (to parse textile additions and the zafu templates) and I thought that doing so many regex evaluations on the full text (can be long) was too slow (please tell if this is wrong). I thus chose to use regex anchored left /\A.../ and eat through the text only once. This has the other advantage that you enter different modes (tag parameters, comments, raw data, etc) along the way. It makes it very easy to parse sub languages from within these modes. The parser is a two step operation: 1. parse, 2. render. This might be overkill for the kind of transformations you need but it is very interesting because the parsed elements can use some knowledge from the context when they are rendered. I intend to do a textile -> Latex transformation so the users can write zafu templates to generate PDF. The current implementation of the parser is not as clean as yours but works. You can have a look at the parser here : http://dev.zenadmin.org/browser/trunk/lib/parser Let me know what you think. Gaspard