The Table of Contents is automatically generated based on the chapters in the book. More correctly, it's based on the parts, chapters, sections, sub-sections, sub-sub-sections, etc.
Here is a section from the Markua manual that shows how to create sub-sections in your book:
(These instructions apply to all books, not just computer programming books!)
With your Book Theme settings, can choose whether to number your parts, chapters, and sub-sections, and whether to use dots, in your Table of Contents.
The way you enable numbering (e.g. 1, 1.1, etc) is in the "Section Numbering" section of a Custom theme. This is also where you choose whether to number parts, and whether the table of contents uses dots between the chapter or section name and the page number.
Please note that custom themes are part of Standard and Pro plans. Here is an article about our Book Themes: http://help.leanpub.com/en/articles/3691789-what-are-the-settings-for-each-of-the-different-book-themes.
Your plan can be edited at https://leanpub.com/author_dashboard/subscriptions
Author subscriptions help pay for us to provide support, and one of the things that requires support is the custom Themes, so we feel this is appropriate...