@Danny_B reported vertical whitespace changes in {{Denní přehled}} on cs.wiktionary.org, e.g. https://cs.wikinews.org/wiki/30._srpen_2017 . Investigation showed that rtrim( $trail, "\n" ) in https://gerrit.wikimedia.org/r/#/c/371735 (for T87753) causes line breaks to be stripped from the following internal link, wherever that is. For example:
> print $wgParser->replaceInternalLinks("[[Category:Foo]]<div>a\n\n[[Foo]]</div>"); <div>a<!--LINK 0:1--></div> > print $wgParser->parse("[[Category:Foo]]<div>a\n\n[[Foo]]</div>", $t, $o)->getText(); <div class="mw-parser-output"><div>a<a href="/index.php?title=Foo&action=edit&redlink=1" class="new" title="Foo (page does not exist)">Foo</a></div>
This is because $trail extends to the start of the next link. Running rtrim() on it makes no apparent sense.