Property | Type | Description | |
---|---|---|---|
$preserve_inline_code_blocks | boolean | Preserve single-line blocks. |
|
$preserve_latex | Preserve the legacy $latex your-latex-code-here$ style LaTeX markup | ||
$preserve_shortcodes | boolean | This requires use within a WordPress installation. | |
$shortcode_end | |||
$shortcode_start | Will run through sprintf - you can supply your own syntax if you want | ||
$strip_paras | boolean | Strip paragraphs from the output. This is the right default for WordPress, which generally wants to create its own paragraphs with wpautop | |
$use_code_shortcode | boolean | Use a [code] shortcode when encountering a fenced code block |
Property | Type | Description | |
---|---|---|---|
$preserve_text_hash | Stores shortcodes we remove and then replace |
Method | Description | |
---|---|---|
__construct ( ) | Set environment defaults based on presence of key functions/classes. | |
_doEscapeForHashWithoutSpacing ( array $m ) : string | Callback for pre-processing start of line hashes to slyly escape headings that don't have a leading space | |
_doFencedCodeBlocks_callback ( $matches ) | Overload to support Viper's [code] shortcode. Because awesome. | |
codeblock_preserve ( string $text ) : string | Preserve code block contents by HTML encoding them. Useful before getting to KSES stripping. | |
codeblock_restore ( string $text ) : string | Restore previously preserved (i.e. escaped) code block contents. | |
doFencedCodeBlocks ( $text ) | Overload to support ```-fenced code blocks for pre-Markdown Extra 1.2.8 https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks | |
do_codeblock_preserve ( array $matches ) : string | Regex callback for code block preservation. | |
do_codeblock_restore ( array $matches ) : string | Regex callback for code block restoration (unescaping). | |
do_single_line_code_preserve ( array $matches ) : string | Regex callback for inline code presevation | |
single_line_code_preserve ( string $text ) : string |
Prevents blocks like __this__ from turning into this |
|
transform ( string $text ) : string | Overload to specify heading styles only if the hash has space(s) after it. This is actually in keeping with the documentation and eases the semantic overload of the hash character. | |
unp ( string $text ) : string |
Remove bare elements. s with attributes will be preserved. |
Method | Description | |
---|---|---|
_doRemoveText ( array $m ) : string | Regex callback for text preservation | |
do_restore ( string $text ) : string | Restores any text preserved by $this->hash_block() | |
get_shortcode_regex ( ) : string | A regex of all shortcodes currently registered by the current WordPress installation | |
hash_block ( string $text ) : string | Call this to store a text block for later restoration. | |
hash_maker ( string $hash ) : string | Less glamorous than the Keymaker | |
latex_preserve ( string $text ) : string | Called to preserve legacy LaTeX like $latex some-latex-text $ | |
restore_leading_hash ( string $text ) : string | Since we escape unspaced #Headings, put things back later. | |
shortcode_preserve ( string $text ) : string | Called to preserve WP shortcodes from being formatted by Markdown in any way. |
public __construct ( ) |
public _doEscapeForHashWithoutSpacing ( array $m ) : string | ||
$m | array | preg_match matches |
return | string | possibly escaped start of line hash |
public _doFencedCodeBlocks_callback ( $matches ) |
protected _doRemoveText ( array $m ) : string | ||
$m | array | Regex $matches array |
return | string | A placeholder that will later be replaced by the original text |
public codeblock_preserve ( string $text ) : string | ||
$text | string | Markdown/HTML content |
return | string | Markdown/HTML content with escaped code blocks |
public codeblock_restore ( string $text ) : string | ||
$text | string | Markdown/HTML content with escaped code blocks |
return | string | Markdown/HTML content |
public doFencedCodeBlocks ( $text ) |
public do_codeblock_preserve ( array $matches ) : string | ||
$matches | array | Regex matches |
return | string | Codeblock with escaped interior |
public do_codeblock_restore ( array $matches ) : string | ||
$matches | array | Regex matches |
return | string | Codeblock with unescaped interior |
protected do_restore ( string $text ) : string | ||
$text | string | Text that may have hashed preservation placeholders |
return | string | Text with hashed preseravtion placeholders replaced by original text |
public do_single_line_code_preserve ( array $matches ) : string | ||
$matches | array | Regex matches |
return | string | Hashed content for later restoration |
protected get_shortcode_regex ( ) : string | ||
return | string | A regex for grabbing shortcodes. |
protected hash_block ( string $text ) : string | ||
$text | string | Text to preserve for later |
return | string | Placeholder that will be swapped out later for the original text |
protected hash_maker ( string $hash ) : string | ||
$hash | string | An md5 hash |
return | string | A placeholder hash |
protected latex_preserve ( string $text ) : string | ||
$text | string | Text in which to preserve LaTeX |
return | string | Text with LaTeX replaced by a hash that will be restored later |
protected restore_leading_hash ( string $text ) : string | ||
$text | string | text with a leading escaped hash |
return | string | text with leading hashes unescaped |
protected shortcode_preserve ( string $text ) : string | ||
$text | string | Text in which to preserve shortcodes |
return | string | Text with shortcodes replaced by a hash that will be restored later |
__this__
from turning into this
public single_line_code_preserve ( string $text ) : string | ||
$text | string | Text that may need preserving |
return | string | Text that was preserved if needed |
elements.
s with attributes will be preserved.
blocks.
public bool $preserve_inline_code_blocks
return
boolean
Preserve the legacy $latex your-latex-code-here$ style
LaTeX markup
public $preserve_latex
This requires use within a WordPress installation.
public bool $preserve_shortcodes
return
boolean
Stores shortcodes we remove and then replace
protected $preserve_text_hash
Will run through sprintf - you can supply your own syntax if you want
public $shortcode_start
Strip paragraphs from the output. This is the right default for WordPress,
which generally wants to create its own paragraphs with wpautop
public bool $strip_paras
return
boolean
Use a [code] shortcode when encountering a fenced code block
public bool $use_code_shortcode
return
boolean