Pepperminty Wiki Module API

Slimdown
in package

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

Table of Contents

$rules  : mixed
add_rule()  : mixed
Add a rule.
render()  : mixed
Render some Markdown into HTML.

Properties

$rules

public static mixed $rules = array( '/\\r\\n/' => "\n", // new line normalisation '/^(#+)(.*)/' => 'self::header', // headers '/(\\*+)(.*?)\\1/' => '<strong>\\2</strong>', // bold '/(_)(.*?)\\1/' => '<em>\\2</em>', // emphasis '/!\\[(.*)\\]\\(([^\\s]+)\\s(\\d+.+)\\s(left|right)\\)/' => '<img src="\\2" alt="\\1" style="max-width: \\3; float: \\4;" />', // images with size '/!\\[(.*)\\]\\(([^\\s]+)\\s(\\d+.+)\\)/' => '<img src="\\2" alt="\\1" style="max-width: \\3;" />', // images with size '/!\\[(.*)\\]\\((.*)\\)/' => '<img src="\\2" alt="\\1" />', // basic images '/\\[\\[([a-zA-Z0-9\\_\\- ]+)\\|([a-zA-Z0-9\\_\\- ]+)\\]\\]/' => '<a href=\'index.php?page=\\1\'>\\2</a>', //internal links with display text '/\\[\\[([a-zA-Z0-9\\_\\- ]+)\\]\\]/' => '<a href=\'index.php?page=\\1\'>\\1</a>', //internal links '/\\[([^\\[]+)\\]\\(([^\\)]+)\\)/' => '<a href=\'\\2\' target=\'_blank\'>\\1</a>', // links '/\\~\\~(.*?)\\~\\~/' => '<del>\\1</del>', // del '/\\:\\"(.*?)\\"\\:/' => '<q>\\1</q>', // quote '/`(.*?)`/' => '<code>\\1</code>', // inline code '/\\n\\s*(\\*|-)(.*)/' => 'self::ul_list', // ul lists '/\\n[0-9]+\\.(.*)/' => 'self::ol_list', // ol lists '/\\n(&gt;|\\>)(.*)/' => 'self::blockquote', // blockquotes '/\\n-{3,}/' => "\n<hr />", // horizontal rule '/\\n([^\\n]+)\\n\\n/' => 'self::para', // add paragraphs '/<\\/ul>\\s?<ul>/' => '', // fix extra ul '/<\\/ol>\\s?<ol>/' => '', // fix extra ol '/<\\/blockquote><blockquote>/' => "\n", )

Methods

add_rule()

Add a rule.

public static add_rule(mixed $regex, mixed $replacement) : mixed
Parameters
$regex : mixed
$replacement : mixed
Return values
mixed

render()

Render some Markdown into HTML.

public static render(mixed $text) : mixed
Parameters
$text : mixed
Return values
mixed

Search results