Source: cirosantilli/sponsor/updates/4/the-table-of-contents-shows-across-different-files-via-include

= The table of contents shows across different files via `\Include`

E.g.:

README.ciro
``
= My website

== h2

\Include[not-readme]
``
not-readme.ciro
``
= Not readme

== Not readme h2
``
the table of contents for `index.html` also contains the headers for `not-readme.ciro` producing:
* My website
  * h2
    * Not readme
      * Not readme h2

This feature means that you can split large input files if rendering starts to slow you down, and things will still render exactly the same, with the larger table of contents.

This will be especially important for the website because initially I want users to be able to edit one header at a time, and join all headers with `\Include`. But I still want the ToC to show those children.

This was a bit hard because it required doing RECURSIVE SQL queries, something I hadn't done before: https://stackoverflow.com/questions/192220/what-is-the-most-efficient-elegant-way-to-parse-a-flat-table-into-a-tree/192462#192462 + of course the usual refactor a bunch of stuff and fix tests until you go mad.