ColorExtension.php 429 B

123456789101112131415
  1. <?php
  2. namespace App\Markdown;
  3. use League\CommonMark\Environment\EnvironmentBuilderInterface;
  4. use League\CommonMark\Extension\ExtensionInterface;
  5. class ColorExtension implements ExtensionInterface
  6. {
  7. public function register(EnvironmentBuilderInterface $environment): void
  8. {
  9. $environment->addInlineParser(new ColorParser(), 200);
  10. $environment->addRenderer(ColorText::class, new ColorRenderer());
  11. }
  12. }