- 
                Notifications
    You must be signed in to change notification settings 
- Fork 216
Description
Describe the bug
When trying build a document via sphinx that ends with a heading, I see the following warning:
foo.md:0: WARNING: Document or section may not begin with a transition.
The warning makes it seem like there was a problem parsing the metadata at the front of the file, when the problem is (or seems to be, anyway) that the file ends with a heading.
To Reproduce
I noticed this when trying to build files that had heading to denote the footnotes or references. For example:
# My article                                                                    
                                                                                
Here's my footnote [^1].                                                        
                                                                                
## Footnotes                                                                    
                                                                                
[^1]: my footnote.
This file was included in a project using the myst_nb sphinx extension, and the warning above would appear during the sphinx build process.
If you delete the ## Footnotes, the warning disappears, so my hypothesis was that the myst-parser doesn't allow you to end documents with headings.
Expected behavior
Either allow a document to end with headings, or explicitly catch the "document's shouldn't end with a heading" pattern and raise an error/warning with a specific message to that effect.
Environment
- Python Version: 3.9.3
- Package versions or output of jupyter-book --version:- myst_nb: 0.12.0
- myst_parser: 0.13.6
 
- Operating System: Linux
Additional context
I wasn't sure if this should be reported to myst_nb or here, but in the end it seemed like the root cause was something to do with the markdown parsing. If not, please feel free to transfer the issue to a more appropriate repo. If there are problems transferring, LMK and I'd be happy to close this and open a new issue elsewhere.