API code uses Linker::makeHeadline() wrong, creating incorrect HTML. The second argument ($attribs) is apparently required to end with a '>'. There are two incorrect uses in ApiMain.php.
This is hidden by Tidy or something cleaning up the brokenness, but if you insert some var_dump in some strategic places, you'll see that we generate HTML like <div id="main/credits"></div><h3 class="apihelp-header"<span class="mw-headline" id="main.2Fcredits">Credits</span></h3> with the <h3> opening tag missing the >.
This probably shouldn't even use that weird function and just do Html::element(), like in ApiHelp.php.