registerPreprocessor($cleanupPreprocessor); $this->registerPreprocessor($blocksWidthPreprocessor); $this->registerPreprocessor($typographyPreprocessor); $this->registerPreprocessor($spacingPreprocessor); $this->registerPostprocessor($highlightingPostprocessor); $this->registerPostprocessor($variablesPostprocessor); } /** * @param array $parsedBlocks * @param array{contentSize: string} $layout * @param array{spacing: array{padding: array{bottom: string, left: string, right: string, top: string}, blockGap: string}} $styles * @return array */ public function preprocess(array $parsedBlocks, array $layout, array $styles): array { foreach ($this->preprocessors as $preprocessor) { $parsedBlocks = $preprocessor->preprocess($parsedBlocks, $layout, $styles); } return $parsedBlocks; } public function postprocess(string $html): string { foreach ($this->postprocessors as $postprocessor) { $html = $postprocessor->postprocess($html); } return $html; } public function registerPreprocessor(Preprocessor $preprocessor): void { $this->preprocessors[] = $preprocessor; } public function registerPostprocessor(Postprocessor $postprocessor): void { $this->postprocessors[] = $postprocessor; } }