From: Vincent Vanwaelscappel Date: Wed, 14 Jan 2026 18:00:53 +0000 (+0100) Subject: wip #7894 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1c47b1f5be2cd335d034a64fe10000e59473241f;p=cubist_util.git wip #7894 @0.5 --- diff --git a/src/Markdown.php b/src/Markdown.php new file mode 100644 index 0000000..a672286 --- /dev/null +++ b/src/Markdown.php @@ -0,0 +1,44 @@ + [ + 'wrap' => [ + 'enabled' => false, + 'tag' => 'div', + 'attributes' => [], + ], + 'alignment_attributes' => [ + 'left' => ['align' => 'left'], + 'center' => ['align' => 'center'], + 'right' => ['align' => 'right'], + ], + ], + ]; + + $environment = new Environment($config); + $environment->addExtension(new CommonMarkCoreExtension()); + $environment->addExtension(new TableExtension()); + $environment->addExtension(new AutolinkExtension()); + + $converter = new MarkdownConverter($environment); + + $h = $converter->convert($md)->getContent(); + if (!$images) { + $h = preg_replace('/

/U', '', $h); + $h = str_replace("/\n+/", "\n", $h); + } + return $h; + } +} \ No newline at end of file