4 * @file library/markdown.php
6 * @brief Parser for Markdown files
9 require_once "library/php-markdown/Michelf/MarkdownExtra.inc.php";
10 use \Michelf\MarkdownExtra;
13 * @brief This function parses a text using php-markdown library to render Markdown syntax to HTML
15 * This function is using the php-markdown library by Michel Fortin to parse a
16 * string ($text).It returns the rendered HTML code from that text. The optional
17 * $hardwrap parameter is used to switch between inserting hard breaks after
18 * every linefeed, which is required for Diaspora compatibility, or not. The
19 * later is used for parsing documentation and README.md files.
22 * @param boolean $hardwrap
26 function Markdown($text, $hardwrap = true) {
29 $stamp1 = microtime(true);
31 $MarkdownParser = new MarkdownExtra();
32 $MarkdownParser->hard_wrap = $hardwrap;
33 $html = $MarkdownParser->transform($text);
35 $a->save_timestamp($stamp1, "parser");