36 callable $shouldModifyCallback,
37 callable $modifyCallback,
38 bool $html5format =
true
41 $formatter =
new class( [], $shouldModifyCallback, $modifyCallback ) extends HtmlFormatter {
45 $formatter =
new class( [], $shouldModifyCallback, $modifyCallback ) extends
RemexCompatFormatter {
49 $serializer =
new Serializer( $formatter );
50 $treeBuilder =
new TreeBuilder( $serializer, $html5format ? [] : [
51 'ignoreErrors' =>
true,
52 'ignoreNulls' =>
true,
54 $dispatcher =
new Dispatcher( $treeBuilder );
55 $tokenizer =
new Tokenizer( $dispatcher, $htmlFragment, $html5format ? [] : [
58 'ignoreErrors' =>
true,
59 'ignoreCharRefs' =>
true,
60 'ignoreNulls' =>
true,
61 'skipPreprocess' =>
true,
64 $tokenizer->execute( [
65 'fragmentNamespace' => HTMLData::NS_HTML,
66 'fragmentName' =>
'body',
69 return $serializer->getResult();