There isn't a perfect way that I'm aware of. In LaTeX, the commands end up translating to direct formatting commands that only make sense in a fixed layout document, so HTML conversion will be an approximation at best. I think Pandoc (http://johnmacfarlane.net/pandoc/) does a reasonable job though.
It may not be quite what you want, but https://www.softcover.io/ is a platform which aims to let you write eBooks in Markdown/TeX and publish them to PDF/HTML and eBook formats.