That part works fine actually and is how I usually generate them, the problem is that then I need to tell people to download and open specifically in a browser. If they see previews in something like google drive, they see raw HTML.
Technically, all this is fine - the problem comes entirely from not having a nice agreed way of opening them. Which makes it more frustrating.
Does HTML with data URIs meet these criteria?