1 | <?php |
||
20 | class Converter implements ConverterInterface |
||
21 | { |
||
22 | /** |
||
23 | * The document parser instance. |
||
24 | * |
||
25 | * @var \League\CommonMark\DocParserInterface |
||
26 | */ |
||
27 | protected $docParser; |
||
28 | |||
29 | /** |
||
30 | * The html renderer instance. |
||
31 | * |
||
32 | * @var \League\CommonMark\ElementRendererInterface |
||
33 | */ |
||
34 | protected $htmlRenderer; |
||
35 | |||
36 | /** |
||
37 | * Create a new commonmark converter instance. |
||
38 | * |
||
39 | * @param DocParserInterface $docParser |
||
40 | * @param ElementRendererInterface $htmlRenderer |
||
41 | */ |
||
42 | 2334 | public function __construct(DocParserInterface $docParser, ElementRendererInterface $htmlRenderer) |
|
47 | |||
48 | /** |
||
49 | * Converts CommonMark to HTML. |
||
50 | * |
||
51 | * @param string $commonMark |
||
52 | * |
||
53 | * @throws \RuntimeException |
||
54 | * |
||
55 | * @return string |
||
56 | * |
||
57 | * @api |
||
58 | */ |
||
59 | 2325 | public function convertToHtml(string $commonMark): string |
|
65 | |||
66 | /** |
||
67 | * Converts CommonMark to HTML. |
||
68 | * |
||
69 | * @see Converter::convertToHtml |
||
70 | * |
||
71 | * @param string $commonMark |
||
72 | * |
||
73 | * @throws \RuntimeException |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | 3 | public function __invoke(string $commonMark): string |
|
81 | } |
||
82 |