Steps to reproduce:
Create a page with a heading 1 (text: "Heading")
Select a couple of letter in the middle (for example, "ead"), hover over them
Add inline Confluence comment
Export the page with default template
Heading should not have any spaces within the word
Heading is exported as "H ead ing"
Remove the text with inline comment (even resolved one), re-type it again, save the page.