2011-04-11 14:59:26 +02:00
|
|
|
<?php
|
2015-02-23 08:27:35 +01:00
|
|
|
//# Install PSR-0-compatible class autoloader
|
|
|
|
//spl_autoload_register(function($class){
|
|
|
|
// require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
|
|
|
|
//});
|
2011-04-11 14:59:26 +02:00
|
|
|
|
2015-02-23 08:27:35 +01:00
|
|
|
require_once("library/php-markdown/Michelf/MarkdownExtra.inc.php");
|
|
|
|
# Get Markdown class
|
|
|
|
use \Michelf\MarkdownExtra;
|
2015-02-22 20:06:13 +01:00
|
|
|
|
2015-02-23 08:27:35 +01:00
|
|
|
function Markdown($text) {
|
2015-02-24 00:08:17 +01:00
|
|
|
|
|
|
|
$a = get_app();
|
|
|
|
|
|
|
|
$stamp1 = microtime(true);
|
|
|
|
|
2015-02-23 08:27:35 +01:00
|
|
|
# Read file and pass content through the Markdown parser
|
2017-03-24 02:23:00 +01:00
|
|
|
$MarkdownParser = new MarkdownExtra();
|
|
|
|
$MarkdownParser->hard_wrap = true;
|
|
|
|
$html = $MarkdownParser->transform($text);
|
2015-02-22 20:06:13 +01:00
|
|
|
|
2015-02-24 10:21:09 +01:00
|
|
|
$a->save_timestamp($stamp1, "parser");
|
2015-02-24 00:08:17 +01:00
|
|
|
|
2015-02-23 08:27:35 +01:00
|
|
|
return $html;
|
2011-04-11 14:59:26 +02:00
|
|
|
}
|
2015-02-22 17:38:28 +01:00
|
|
|
?>
|