Fix headingLevelOfElement() to skip headings that arent' in its outline ancestors.
Refactor headingLevelOfElements to use a relevantHeaders iter.