@lthms it's not *that* hard but it's annoying. Basically an epub is one or more HTML documents with an XML "metadata" file, in a zip.
the annoying part is figuring out what mutually incompatible subset of html is supported by all the different readers you want to target