You also might want to take a look at GitBook (https://www.gitbook.com/).

It supports both Markdown and AsciiDoc and is used by authors to write books, documentation, research-papers (GitBook has great TeX support, in all outputs: web, pdf, epub, mobi). (Here's a math heavy book for example: http://jandeleeuw.gitbooks.io/bras1/content/blockrelaxation/...)

The format and toolchain itself is open-source (https://github.com/GitbookIO/gitbook)

There's a ecosystem built on top of that such as a Desktop Editor (https://www.gitbook.com/editor), plugins (http://plugins.gitbook.com/), and more ...

I don't want to hijack the current thread, Madoko seems really cool, I thought some of you might be interested in a more established solution. I'm happy to answer any questions !

Disclaimer: I'm one of the GitBook co-founders

+1 for Madoko as it's free and Gitbook is not. I can use Madoko to create and publish my content and keep 100% of the income unlike Gitbook that takes a cut.

How dare someone provide a service for remuneration!

Free and FOSS, the latter being more important. I can customize and self-host Madoko.

> The format and toolchain itself is open-source (https://github.com/GitbookIO/gitbook)