Markdown plugin

markdown plugin by Carl-Christian Salvesen
enables you to write pages using the markdown syntax

Last updated on 2006-05-24. Provides Syntax.
No compatibility info given!

Similar to markdownextra.

Tagged with formatting, markup_language.

    Details and Download

    markdown syntax

    Website With Plugin Currently Down

    Use newer markdownextra plugin instead.

    If you want to use the old markdown, you can download PHP Markdown and use the following syntax.php:

    syntax.php

    <?php
    /**
     * markdown-Plugin: Parses markdown-blocks
     *
     * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
     * @author     Sebastian Siedentopf <openmail@siezi.com>
     */
     
    // must be run within DokuWiki
    if(!defined('DOKU_INC')) die();
     
    if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
    require_once(DOKU_PLUGIN.'syntax.php');
    require_once(DOKU_PLUGIN.'markdown/markdown.php');
     
     
    /**
     * All DokuWiki plugins to extend the parser/rendering mechanism
     * need to inherit from this class
     */
    class syntax_plugin_markdown extends DokuWiki_Syntax_Plugin {
     
        /**
         * return some info
         */
        function getInfo(){
            return array(
                'author' => 'Sebastian Siedentopf',
                'email'  => 'openmail@siezi.com',
                'date'   => '2008-08-28',
                'name'   => 'Markdown Plugin',
                'desc'   => 'Parses Markdown Bocks',
                'url'    => 'http://www.dokuwiki.org/plugin:markdown',
            );
        }
     
        /**
         * What kind of syntax are we?
         */
        function getType(){
            return 'protected';
        }
     
        /**
         * Where to sort in?
         */
        function getSort(){
            return 69;
        }
     
        function getPType() {
            return 'block';
        }
     
        /**
         * Connect pattern to lexer
         */
        function connectTo($mode) {
            $this->Lexer->addEntryPattern('<markdown>(?=.*</markdown>)',$mode,'plugin_markdown');
        }
     
        function postConnect() {
          $this->Lexer->addExitPattern('</markdown>','plugin_markdown');
        }
     
        /**
         * Handle the match
         */
        function handle($match, $state, $pos, &$handler){
            return array($match);
        }
     
        /**
         * Create output
         */
        function render($mode, &$renderer, $data) {
            if($mode == 'xhtml' && $data[0] != "<markdown>" && $data[0] !=
            "</markdown>") {
                $renderer->doc .= Markdown($data[0]);
                return true;
            }
            return false;
        }
     
    }
     
    //Setup VIM: ex: et ts=4 enc=utf-8 :
    ?>
     
    plugin/markdown.txt · Last modified: 2009/10/07 14:21 by laynee
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate