I was having a similar issue. I had html being displayed at the top of some of my buddypress pages. I finally found the culprit to be this bit of code I was using in the <head> section of my site —>
<meta name=”twitter:title” content=”<?php the_title(); ?>”>
Changing it to the following fixed my problem —>
<meta name=”twitter:title” content=”some static text here instead”>
Now I just need to figure out how to make it work with the PHP code without generating random HTML at the top of my page.