Install from JahiaPublic Appstore, enable for your website, then find the component from the site components.
To add a table of content in your page, drad and drop the component whenever you want to display it. You can choose the tree depth from 1 (only first level) to 4, and also the starting heading (h1,h2,h3,h4)
If you don't want a table of content for all your table, use the "pin" icon and select the target you want to use. It can be any editorial component of any content list.