blob: cb854b475939203dc9757d74d5da6af082866fab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
/* Icinga Web 2 | (c) 2019 Icinga GmbH | GPLv2+ */
namespace Icinga\Web\Helper;
use Icinga\Web\Helper\Markdown\LinkTransformer;
use Parsedown;
class Markdown
{
public static function line($content, $config = null)
{
if ($config === null) {
$config = function (\HTMLPurifier_Config $config) {
$config->set('HTML.Parent', 'span'); // Only allow inline elements
LinkTransformer::attachTo($config);
};
}
return HtmlPurifier::process(Parsedown::instance()->line($content), $config);
}
public static function text($content, $config = null)
{
if ($config === null) {
$config = function (\HTMLPurifier_Config $config) {
LinkTransformer::attachTo($config);
};
}
return HtmlPurifier::process(Parsedown::instance()->text($content), $config);
}
}
|