issue #1964: Fix to ignore heading for extracted section, added missing tests

Quick bugfix for case where the header was extracted along with the section content. Also added tests that were somehow missing from the previous PR that should have caught this :angry: