MediaWiki automatically creates a TOC using section headings on all pages with more than 3 headings. This TOC is collapsible (thus saving space); there is also a 'Show table of contents' user preference setting (enabling users to prevent the TOC from being shown at all).
Previously the TOC was inline, as for Wikipedia, but the new docs theme has positioned it in the right column below the navigation block.
I am amending the issue description, since based on feedback received, it seems we should put the TOC back inline. We can then consider possible TOC improvements, as suggested by Andrew Lyons:
I feel that for a long document, having the ToC scroll as you move down the page would be a major benefit.
For pages where the ToC is longer than the visible height, we should allow the ToC to be scroll independently of the page, but initially with. Lots of places do this.
If we add some other contnet beneath the ToC, this should be fine too to keep scrolled.