Adding plugin title to Table of Content Macro during Confluence PDF export

When a third party macro is inserted as a header <h1,h2,…h8> in the confluence document, the table content plugin renders the plugin title as basic HTML text of the plugin displayed in view mode. The scroll PDF export also reflects the same.

Is there any way of returning the plugin title to the scroll PDF export when plugin is placed in the Header section of the confluence page ?