]> git.nbdom.net Git - nb.git/commitdiff
add function md2html, TODEL in function.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 21 Dec 2016 22:31:44 +0000 (22:31 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 21 Dec 2016 22:31:44 +0000 (22:31 +0000)
lib/php/nb.php

index 4cb85e899dbdb10a48c6c941c9a9795b20ee4827..0b9fb4148f1f93f56faf3824ceece3a498d69d39 100644 (file)
@@ -897,6 +897,15 @@ class NB {
     return file_exists('/proc/cpuinfo') && preg_match('/^flags.* hypervisor/m',file_get_contents('/proc/cpuinfo'));
   }
 
+  public static function md2html($txt) {
+    static $_txt2md = null;
+    if ($_txt2md === null) {
+      require_once(dirname(__FILE__).'/parsedown/Parsedown.php');
+      $_txt2md = new Parsedown();
+    }
+    return $_txt2md->text($txt);
+  }
+
 } # < Class
 
 return;