/** * Highlight (color) the given piece of source code * * @param string $text Text to highlight * @param string $role Source code role to use (php, xml, html, ...) * @param string $format Format to highlight (pdf, xhtml, troff, ...) * * @return string Highlighted code */ public function highlight($text, $role = 'php', $format = 'xhtml') { if (!isset(self::$highlighters[$format])) { $class = Config::highlighter(); self::$highlighters[$format] = $class::factory($format); } return self::$highlighters[$format]->highlight($text, $role, $format); }