]> git.mxchange.org Git - friendica.git/blobdiff - library/markdown.php
Tests with new markdown library
[friendica.git] / library / markdown.php
index 83082f7ca77072a4eee47ef82bca1ccba814c1a8..8958e8c842ca129d88d7b14f0910195c7130a50b 100644 (file)
@@ -1,13 +1,17 @@
 <?php
-require_once("library/parsedown/Parsedown.php");
+//# Install PSR-0-compatible class autoloader
+//spl_autoload_register(function($class){
+//     require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
+//});
 
-function Markdown($text) {
+require_once("library/php-markdown/Michelf/MarkdownExtra.inc.php");
+# Get Markdown class
+use \Michelf\MarkdownExtra;
 
-       // Bugfix for the library:
-       // "[Title](http://domain.tld/ )" isn't handled correctly
-       $text = preg_replace("/\[(.*?)\]\s*?\(\s*?(\S*?)\s*?\)/ism", '[$1]($2)', $text);
+function Markdown($text) {
+       # Read file and pass content through the Markdown parser
+       $html = MarkdownExtra::defaultTransform($text);
 
-       $Parsedown = new Parsedown();
-       return($Parsedown->text($text));
+       return $html;
 }
 ?>