Заменить что угодно в выводе ничто не мешает и штатными средствами PHP. Например хуком для класса \IPS\Output:
public function sendOutput( $output='', $httpStatusCode=200, $contentType='text/html', $httpHeaders=array(), $cacheThisPage=TRUE, $pageIsCached=FALSE, $parseFileObjects=TRUE, $parseEmoji=TRUE )
{
if( preg_match( '#<div\sclass="zzz"><h1\sclass="www">Title</h1></div>\n?\r?(<a[^<>]*</a>)#s', $output, $match ) )
{
$replace = '<!--my_replece_code-->';
$output = str_replace( $match[1], $replace, $output );
}
parent::sendOutput( $output, $httpStatusCode, $contentType, $httpHeaders, $cacheThisPage, $pageIsCached, $parseFileObjects, $parseEmoji )
}