Currently the table of contents is a bit of a mess scattered across several levels of the parser, as well as the skinning backend and the linker, with no single clear place where its list is compiled and parsed into an actual table of contents.
It should all be in one place, with a proper API. It should get its list somewhere, be flexible enough to take sections from non-standard sources as well (parser extensions, skins, whatever), and assemble the actual thing all in one place where it can be changed and reused without having to hunt down random bits in five different classes.