<?php
-require_once("library/parsedown/Parsedown.php");
+require_once "library/php-markdown/Michelf/MarkdownExtra.inc.php";
+use \Michelf\MarkdownExtra;
function Markdown($text) {
+ $a = get_app();
- // Bugfix for the library:
- // "[Title](http://domain.tld/ )" isn't handled correctly
- $text = preg_replace("/\[(.*?)\]\s*?\(\s*?(\S*?)\s*?\)/ism", '[$1]($2)', $text);
+ $stamp1 = microtime(true);
- $Parsedown = new Parsedown();
- return($Parsedown->text($text));
+ $MarkdownParser = new MarkdownExtra();
+ $MarkdownParser->hard_wrap = true;
+ $html = $MarkdownParser->transform($text);
+
+ $a->save_timestamp($stamp1, "parser");
+
+ return $html;
}
-?>