diff options
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | README.rst | 3 | ||||
| -rw-r--r-- | data/config.default.php | 5 | ||||
| -rw-r--r-- | src/phorkie/Renderer/Markdown.php | 27 |
4 files changed, 39 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2012-09-18 Justin J. Novack <jnovack@gmail.com> + + * Add Markdown as a known file-type. + 2012-09-17 Justin J. Novack <jnovack@gmail.com> * Add OpenID authentication @@ -84,6 +84,9 @@ phorkie stands on the shoulders of giants. $ pear channel-discover zustellzentrum.cweiske.de $ pear install zz/mime_type_plaindetect-alpha + $ pear channel-discover pear.michelf.ca + $ pear install michelf/Markdown + Note that this version of GeSHi is a bit outdated, but it's the fastest way to install it. diff --git a/data/config.default.php b/data/config.default.php index a087767..abcb43e 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -66,6 +66,11 @@ $GLOBALS['phorkie']['languages'] = array( 'mime' => 'application/javascript', 'geshi' => 'javascript' ), + 'md' => array( + 'title' => 'Markdown', + 'mime' => 'text/x-markdown', + 'renderer' => '\\phorkie\\Renderer_Markdown' + ), 'pl' => array( 'title' => 'Perl', 'mime' => 'application/x-perl', diff --git a/src/phorkie/Renderer/Markdown.php b/src/phorkie/Renderer/Markdown.php new file mode 100644 index 0000000..628d87f --- /dev/null +++ b/src/phorkie/Renderer/Markdown.php @@ -0,0 +1,27 @@ +<?php +namespace phorkie; + +class Renderer_Markdown +{ + /** + * Converts the code to HTML + * + * @param File $file File to render + * @param Tool_Result $res Tool result to integrate + * + * @return string HTML + */ + public function toHtml(File $file, Tool_Result $res = null) + { + /** + */ + require_once 'markdown.php'; + $markdown = \markdown($file->getContent()); + + return '<div class="markdown">' + . $markdown + . '</div>'; + } +} + +?> |
