This article talks:
The outline also known as the table of content is a list of one or more potentially nested sections.
The outline algorithm 1) extracts this information from:
Sectioning roots elements can have their own outlines, but the sections and headings inside these elements do not contribute to the outlines of their ancestors. (blockquote, body, details, dialog, fieldset, figure, td)
You can check the outline with the w3 validator by checking the outline option.