Yet Another Regex-Based MarkDown to HTML converter
The whole approach of using regexes to parse Markdown and convert it into HTML is broken.


You have no way of knowing whether any html you generate with one call to gsub is violating the constraints of the HTML containing it.
After the first gsub call, you iteratively apply it to text which now contains some html.  You may mistakenly replace parts of an html element with an html element.


Some of the individual gsub calls are fragile in themselves but none of that compares to the basic flaws of the approach.

Having said that, the way you are using regexes is duplicating code.  You have typed each matched pattern twice: first in the regex, then in the closure.  This would not be necessary if you used capture groups and back-references.