I self published a book with leanpub. I used their online markdown editor. Then I used their preview feature to export in all formats: pdf, epub and mobi.
Then I uploaded these to my gumroad account, created a product and setup a payment widget on my website.