I solved this a different way (create md file with knitr and then md -> html):
text_input <- "markdown text"
library(knitr)
foo.html <- knit2html(text=text_input)
Thanks Yihui. However as I note in the comment below there are still some issues with the resulting html (only with character vector input not regular files).