32function dolMd2Html($content, $parser =
'parsedown', $replaceimagepath =
null)
35 $content = preg_replace(
'/<a href="([^"]+)">([^<]+)<\/a>/',
'[\2](\1)', $content);
37 $content = preg_replace(
'/<a href="([^"]+)" target="([^"]+)">([^<]+)<\/a>/',
'[\3](\1)', $content);
40 $content = preg_replace(
'/<!--.*-->/ms',
'', $content);
42 if (is_array($replaceimagepath)) {
43 foreach ($replaceimagepath as $key => $val) {
44 $keytoreplace =
']('.$key;
45 $valafter =
']('.$val;
46 $content = preg_replace(
'/'.preg_quote($keytoreplace,
'/').
'/m', $valafter, $content);
49 if ($parser ==
'parsedown') {
50 include_once DOL_DOCUMENT_ROOT.
'/includes/parsedown/Parsedown.php';
51 $parsedown =
new Parsedown();
52 $parsedown->setSafeMode(
true);
53 $content = $parsedown->text($content);
55 $content = nl2br($content);