1 | <?php |
||
28 | class CommonMarkConverter implements MarkdownConverterInterface |
||
29 | { |
||
30 | /** |
||
31 | * The currently-installed version. |
||
32 | * |
||
33 | * This might be a typical `x.y.z` version, or `x.y-dev`. |
||
34 | */ |
||
35 | public const VERSION = '2.0-dev'; |
||
36 | |||
37 | /** @var EnvironmentInterface */ |
||
38 | protected $environment; |
||
39 | |||
40 | /** @var DocParserInterface */ |
||
41 | protected $docParser; |
||
42 | |||
43 | /** @var NodeRendererInterface */ |
||
44 | protected $htmlRenderer; |
||
45 | |||
46 | /** |
||
47 | * Create a new commonmark converter instance. |
||
48 | * |
||
49 | * @param array<string, mixed> $config |
||
50 | * @param EnvironmentInterface|null $environment |
||
51 | */ |
||
52 | 2397 | public function __construct(array $config = [], EnvironmentInterface $environment = null) |
|
67 | |||
68 | 9 | public function getEnvironment(): EnvironmentInterface |
|
72 | |||
73 | /** |
||
74 | * Converts CommonMark to HTML. |
||
75 | * |
||
76 | * @param string $commonMark |
||
77 | * |
||
78 | * @throws \RuntimeException |
||
79 | * |
||
80 | * @return string |
||
81 | * |
||
82 | * @api |
||
83 | */ |
||
84 | 2388 | public function convertToHtml(string $commonMark): string |
|
90 | |||
91 | /** |
||
92 | * Converts CommonMark to HTML. |
||
93 | * |
||
94 | * @see Converter::convertToHtml |
||
95 | * |
||
96 | * @param string $commonMark |
||
97 | * |
||
98 | * @throws \RuntimeException |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | 3 | public function __invoke(string $commonMark): string |
|
106 | } |
||
107 |