Here is a way to do Table of Contents (ToC)

This is very cool. Thank you for working on this.

I noticed that the sticky table of contents shifts the text to the left and widens the text box, so there are more words per line. Is there a way to keep the text centered and the text box the same width? I think keeping the text in the center and having fewer words per line makes the content easier to read.

My testing with sticky TOC (compare with the Lyra Demo without TOC):

For non-sticky TOC, the h3 headers add an extra line in the TOC and only appear under the first h2: