+<?php\r
+\r
+/**\r
+ * @file src/Content/Text/Markdown.php\r
+ */\r
+\r
+namespace Friendica\Content\Text;\r
+\r
+use Friendica\BaseObject;\r
+use Michelf\MarkdownExtra;\r
+\r
+/**\r
+ * Friendica-specific usage of Markdown\r
+ *\r
+ * @author Hypolite Petovan <mrpetovan@gmail.com>\r
+ */\r
+class Markdown extends BaseObject\r
+{\r
+ /**\r
+ * Converts a Markdown string into HTML. The hardwrap parameter maximizes\r
+ * compatibility with Diaspora in spite of the Markdown standard.\r
+ *\r
+ * @brief Converts a Markdown string into HTML\r
+ * @param string $text\r
+ * @param bool $hardwrap\r
+ * @return string\r
+ */\r
+ public static function convert($text, $hardwrap = true) {\r
+ $stamp1 = microtime(true);\r
+\r
+ $MarkdownParser = new MarkdownExtra();\r
+ $MarkdownParser->hard_wrap = $hardwrap;\r
+ $html = $MarkdownParser->transform($text);\r
+\r
+ self::getApp()->save_timestamp($stamp1, "parser");\r
+\r
+ return $html;\r
+ }\r
+}\r