title_body: Best platform and format for eBook on software/programming
upvoted_answer: I suggest you of using LaTeX for such work. LaTeX handles multiple types of documents, text and media environments (complex equations as well as images, videos, plots, program source code (you can find packages to provide syntax highlight)), languages. You can also meaningfully use a Version Control System with its source code (like Git). And the end, you can export your book as PDF, PostScript, or other formats.
  
  There are compilers and integrated editors for every major desktop operating system, for example, various Linux Distributions, Windows, or even macOS.