GitBook is a tool for building beautiful books using Git and Markdown. It can generate your book into multiple formats:
Static Website: This is the default format, it generates a complete interactive static website. PDF: A complete PDF book with exercise solutions at the end of the book. eBook: A complete eBook with exercise solutions at the end of the book.
The legacy version of GitBook is open source, but is no longer developed.