Create pico_markdown.php
Trying to decouple Markdown from core. Need a way to replace %base_url%
This commit is contained in:
parent
e942d40187
commit
72edc5a063
1 changed files with 29 additions and 0 deletions
29
plugins/pico_markdown.php
Normal file
29
plugins/pico_markdown.php
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue