Hello,
using jekyll (and github pages) with (remote) octobook themes you can build (online) books from your text w/ markdown formatting. See the latest real-world open-source / open-access example - Bits & Blocks Press Bookshelf (Source) - Free Books about Bitcoins, Blockchains, Contract Scripts ‘n’ More.
Happy publishing w/ Jekyll and Octobook themes.
PS: You can find an intro into how Octobook works in the talks notes for a local ruby meetup earlier this year.