Guides

HighlightPhpHighlighter
in package
implements Highlighter

FinalYes

This class delegates to the Highlighter library the task of highlighting code blocks, adds extra features, and makes sure that errors result in a log line instead of an exception.

Table of Contents

Interfaces

Highlighter

Properties

$highlighter  : Highlighter
$languageAliases  : array<string|int, mixed>
$logger  : LoggerInterface

Methods

__construct()  : mixed
__invoke()  : HighlightResult
escapeForbiddenCharactersInsideCodeBlock()  : string
Code blocks are displayed in "<pre>" tags, which has some reserved characters: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre

Properties

Methods

__construct()

public __construct(Highlighter $highlighter, LoggerInterface $logger[, array<string, string> $languageAliases = ['terminal' => 'bash'] ]) : mixed
Parameters
$highlighter : Highlighter
$logger : LoggerInterface
$languageAliases : array<string, string> = ['terminal' => 'bash']

a map of language aliases to their actual language, for instance "attribute" => "php"

escapeForbiddenCharactersInsideCodeBlock()

Code blocks are displayed in "<pre>" tags, which has some reserved characters: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre

private escapeForbiddenCharactersInsideCodeBlock(string $code) : string
Parameters
$code : string
Return values
string

        
On this page

Search results