1<?php 2 3declare(strict_types=1); 4 5/* 6 * This file is part of the league/commonmark package. 7 * 8 * (c) Colin O'Dell <colinodell@gmail.com> 9 * 10 * For the full copyright and license information, please view the LICENSE 11 * file that was distributed with this source code. 12 */ 13 14namespace League\CommonMark; 15 16use League\CommonMark\Environment\Environment; 17use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; 18use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; 19 20/** 21 * Converts GitHub Flavored Markdown to HTML. 22 */ 23final class GithubFlavoredMarkdownConverter extends MarkdownConverter 24{ 25 /** 26 * Create a new Markdown converter pre-configured for GFM 27 * 28 * @param array<string, mixed> $config 29 */ 30 public function __construct(array $config = []) 31 { 32 $environment = new Environment($config); 33 $environment->addExtension(new CommonMarkCoreExtension()); 34 $environment->addExtension(new GithubFlavoredMarkdownExtension()); 35 36 parent::__construct($environment); 37 } 38 39 public function getEnvironment(): Environment 40 { 41 \assert($this->environment instanceof Environment); 42 43 return $this->environment; 44 } 45} 46