From c8f4fbebc1c1d0fd3f11f888ac7531d9bfc821c4 Mon Sep 17 00:00:00 2001 From: Aaron Francis Date: Fri, 30 Jul 2021 17:41:26 -0500 Subject: [PATCH] Allow Commonmark to be extended. --- src/Commands/BuildCommand.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 3ad6b0e..1ff35a3 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -73,7 +73,7 @@ class BuildCommand extends Command $theme = $this->getTheme($currentPath, $this->themeName); $this->buildPdf( - $this->buildHtml($currentPath.'/content'), + $this->buildHtml($currentPath.'/content', $config), $config, $currentPath, $theme @@ -103,9 +103,10 @@ class BuildCommand extends Command /** * @param string $path + * @param array $config * @return string */ - protected function buildHtml(string $path) + protected function buildHtml(string $path, array $config) { $this->output->writeln('==> Parsing Markdown ...'); @@ -116,6 +117,10 @@ class BuildCommand extends Command 'html', 'php', 'js', 'bash', 'json' ])); + if (is_callable($config['configure_commonmark'])) { + call_user_func($config['configure_commonmark'], $environment); + } + $converter = new GithubFlavoredMarkdownConverter([], $environment); return collect($this->disk->files($path))