Selaa lähdekoodia

Create pico_markdown.php

Trying to decouple Markdown from core.
Need a way to replace %base_url%
SimoneS93 10 vuotta sitten
vanhempi
commit
72edc5a063
1 muutettua tiedostoa jossa 29 lisäystä ja 0 poistoa
  1. 29 0
      plugins/pico_markdown.php

+ 29 - 0
plugins/pico_markdown.php

@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * Write page content in Markdown
+ * @author Simone Salerno 
+ * @version 1.0.0
+ * @license MIT
+ */
+
+class pico_markdown {
+    
+    /**
+     * Parse Markdown content
+     * @param array $data
+     */
+    public function get_page_data(&$data) {
+        $this->parse_content($data['content']);
+    }
+    
+    /**
+     * Parse Markdown content
+     * @param string $content
+     */
+    public function parse_content(&$content) {
+        $content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta
+        #$content = str_replace('%base_url%', $this->base_url(), $content);
+        $content = Michelf\Markdown::defaultTransform($content);
+    }
+}