"Default Parser", "version" => "0.7", "author" => "Johnny Broadway & Starbeamrainbowlabs", "description" => "The default parser for Pepperminty Wiki. Based on Johnny Broadway's Slimdown (with more than a few modifications). This parser's features are documented in the help page.", "id" => "parser-default", "code" => function() { add_parser(function($markdown) { return Slimdown::render($markdown); }); } ]); //////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////// Slimdown ///////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// %slimdown% // //////////////////////////////////////////////////////////////////////////////////////////// /** * Slimdown - A very basic regex-based Markdown parser. Supports the * following elements (and can be extended via Slimdown::add_rule()): * * - Headers * - Links * - Bold * - Emphasis * - Deletions * - Quotes * - Inline code * - Blockquotes * - Ordered/unordered lists * - Horizontal rules * * Author: Johnny Broadway * Website: https://gist.github.com/jbroadway/2836900 * License: MIT */ /** * Modified by Starbeamrainbowlabs (starbeamrainbowlabs) * * Changed bold to use single asterisks * Changed italics to use single underscores * Added one to add the heading levels (no

tags allowed) * Added wiki style internal link parsing * Added wiki style internal link parsing with display text * Added image support */ class Slimdown { public static $rules = array ( '/\r\n/' => "\n", // new line normalisation '/(#+)(.*)/' => 'self::header', // headers '/(\*)(.*?)\1/' => '\2', // bold '/(_)(.*?)\1/' => '\2', // emphasis '/!\[(.*)\]\(([^\s]+)\s(\d+.+)\s(left|right)\)/' => '\1', // images with size '/!\[(.*)\]\(([^\s]+)\s(\d+.+)\)/' => '\1', // images with size '/!\[(.*)\]\((.*)\)/' => '\1', // basic images '/\[\[([a-zA-Z0-9\_\- ]+)\|([a-zA-Z0-9\_\- ]+)\]\]/' => '\2', //internal links with display text '/\[\[([a-zA-Z0-9\_\- ]+)\]\]/' => '\1', //internal links '/\[([^\[]+)\]\(([^\)]+)\)/' => '\1', // links '/\~\~(.*?)\~\~/' => '\1', // del '/\:\"(.*?)\"\:/' => '\1', // quote '/`(.*?)`/' => '\1', // inline code '/\n\s*(\*|-)(.*)/' => 'self::ul_list', // ul lists '/\n[0-9]+\.(.*)/' => 'self::ol_list', // ol lists '/\n(>|\>)(.*)/' => 'self::blockquote', // blockquotes '/\n-{3,}/' => "\n
", // horizontal rule '/\n([^\n]+)\n\n/' => 'self::para', // add paragraphs '/<\/ul>\s?