Write toc to json to render as data in a partial.

Toc for Elements also gets the treatment.