Describe the bug
The rendered toc breaks when a document has multiple top level headers
To Reproduce
To reproduce create a book with a document which has two top level headers:
jupyter-book create test_book && cd test_bookecho "[{file: intro}, {part: part, chapters: [{file: content, title: title}]}]" > _toc.ymlprintf "# title1\n\n# title2" > content.mdjupyter-book build .Observe that the resulting toc looks like this:

So there are two toc entries, each referring to a different section within the source file. The title key from the toc is completely ignored.
This contradicts to the docs:
Chapters are the top-most book structure. The top level of your
_toc.ymlcontains a list of chapters. The title of each file will be the chapter鈥檚 title.
Expected behavior
I'd expect one of the following to happen
title toc key.Environment
jupyter-book --version:Jupyter Book: 0.7.5
MyST-NB: 0.10.0
Sphinx Book Theme: 0.0.36
MyST-Parser: 0.12.7
Jupyter-Cache: 0.4.1
Hmm - well there is also this: https://jupyterbook.org/content-types/index.html#rules-for-all-content-types
which says you shouldn't have multiple top-level headers. We could make this raise a warning? Not sure how exactly to do it though...
That's reasonable, I assumed that it'd be the case. Would be also good to mention it around https://jupyterbook.org/customize/toc.html#how-headers-and-sections-map-onto-to-book-structure as well. Nevertheless the breaking is subtle and not obvious at a glance. Therefore I suggest to raise an error.
@choldgraf I think a warning here would be good. You have done a nice job in the current docs but some users won't read through it :-) and might prevent bug reports.
thanks for these test cases @akhmerov. I am currently doing some homework to understand how various toc structures are working (in addition to some common patterns I think users will try) in an effort to improve the relationship between _toc.yml and some more complex book elements such as frontmatter etc. Playing with some upstream ideas for support of special toctree elements in sphinx in this thread for appendix and frontmatter to help control style in html and latex based on more contextual info.
@mmcky frontmatter / appendix sound great.
Note for catching of the error: due to sphinx peculiarities, multiple h2 in a document that lacks h1 will lead to the same result.
note - I am all for warnings, I'm just not sure how to do it! PRs are welcome :-)