]> git.mxchange.org Git - friendica.git/blob - library/markdown.php
Enable hard_wrap for Markdown parser to match Diaspora parsing
[friendica.git] / library / markdown.php
1 <?php
2 //# Install PSR-0-compatible class autoloader
3 //spl_autoload_register(function($class){
4 //      require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
5 //});
6
7 require_once("library/php-markdown/Michelf/MarkdownExtra.inc.php");
8 # Get Markdown class
9 use \Michelf\MarkdownExtra;
10
11 function Markdown($text) {
12
13         $a = get_app();
14
15         $stamp1 = microtime(true);
16
17         # Read file and pass content through the Markdown parser
18         $MarkdownParser = new MarkdownExtra();
19         $MarkdownParser->hard_wrap = true;
20         $html = $MarkdownParser->transform($text);
21
22         $a->save_timestamp($stamp1, "parser");
23
24         return $html;
25 }
26 ?>