Rework display of headings button and fixed an error reading nested paragraphs (where paragraph text is contained as part of a picture).