Forgive me if this is a stupid question or at least an over asked one but i was wondering how exactly i can convert html to epub? And can i create a TOC with h1/h2 code in html? I'd like to just start composing my works in a text edit in html and convert it. Is this possible? I tried saving the text file as an html then converting it in calibre but all i got was the code. Any input would appreciated.

Forgive me if this is a stupid question or at least an over asked one but i was wondering how exactly i can convert html to epub? And can i create a TOC with h1/h2 code in html? I'd like to just start composing my works in a text edit in html and convert it. Is this possible? I tried saving the text file as an html then converting it in calibre but all i got was the code. Any input would appreciated.