As user dvt mentioned, this is built using bookdown[1], an R library (with the help of Pandoc). You can see that the example chapter of this book looks exactly like the bookdown output[2]. The bookdown PDF explains in detail how to use Rmd+RStudio+R+Pandoc+Markdown to publish this.
bweber|6 years ago
You can use the same tooling to create an epub output, but the formatting will be substantially different.