ParsedownExtension
extends ParsedownToC
in package
Further Extends Parsedown
Table of Contents
Constants
- ID_ATTRIBUTE_DEFAULT = 'toc'
- TAG_TOC_DEFAULT = '[toc]'
- version = '1.1.2'
- ------------------------------------------------------------------------ Constants.
- VERSION = '0.0.0'
- VERSION_PARSEDOWN_REQUIRED = '1.7'
Properties
- $gfx_fmt : mixed
- $graphviz_modes : mixed
- $headown : mixed
- $BlockTypes : mixed
- $breaksEnabled : mixed
- $contentsListArray : mixed
- $contentsListString : mixed
- $DefinitionData : mixed
- $EmRegex : mixed
- $firstHeadLevel : mixed
- $inlineMarkerList : mixed
- $InlineTypes : mixed
- $markupEscaped : mixed
- $regexHtmlAttribute : mixed
- $safeLinksWhitelist : mixed
- $safeMode : mixed
- $specialCharacters : mixed
- $StrongRegex : mixed
- $tag_toc : mixed
- $textLevelElements : mixed
- $unmarkedBlockTypes : mixed
- $urlsLinked : mixed
- $voidElements : mixed
- $instances : mixed
Methods
- __construct() : mixed
- Version requirement check.
- body() : string
- Parses the given markdown string to an HTML string but it leaves the ToC tag as is. It's an alias of the parent method "\DynamicParent::text()".
- contentsList() : string
- Returns the parsed ToC.
- instance() : mixed
- line() : mixed
- parse() : mixed
- setBreaksEnabled() : mixed
- setMarkupEscaped() : mixed
- setSafeMode() : mixed
- setTagToc() : void
- Sets the user defined ToC markdown tag.
- setUrlsLinked() : mixed
- text() : void
- Parses markdown string to HTML and also the "[toc]" tag as well.
- blockCode() : mixed
- blockCodeComplete() : mixed
- blockCodeContinue() : mixed
- blockComment() : mixed
- blockCommentContinue() : mixed
- blockFencedCode() : mixed
- blockFencedCodeComplete() : mixed
- blockFencedCodeContinue() : mixed
- blockHeader() : void|array<string|int, mixed>
- Heading process.
- blockList() : mixed
- blockListComplete() : mixed
- blockListContinue() : mixed
- blockMarkup() : mixed
- blockMarkupContinue() : mixed
- blockQuote() : mixed
- blockQuoteContinue() : mixed
- blockReference() : mixed
- blockRule() : mixed
- blockSetextHeader() : mixed
- blockTable() : mixed
- blockTableComplete() : mixed
- blockTableContinue() : mixed
- createAnchorID() : string
- Generates an anchor text that are link-able even the heading is not in ASCII.
- decodeTagFromHash() : string
- Decodes the hashed ToC tag to an original tag and replaces.
- element() : mixed
- elements() : mixed
- encodeTagToHash() : string
- Encodes the ToC tag to a hashed tag and replace.
- escape() : mixed
- fetchText() : string
- Get only the text from a markdown string.
- filterUnsafeUrlInAttribute() : mixed
- getIdAttributeToC() : string
- Gets the ID attribute of the ToC for HTML tags.
- getSalt() : string
- Unique string to use as a salt value.
- getTagToC() : string
- Gets the markdown tag for ToC.
- inlineCode() : mixed
- inlineEmailTag() : mixed
- inlineEmphasis() : mixed
- inlineEscapeSequence() : mixed
- inlineForcedBr() : mixed
- inlineImage() : mixed
- inlineInsertedText() : mixed
- inlineKbdText() : mixed
- inlineLink() : mixed
- inlineMarkedText() : mixed
- inlineMarkup() : mixed
- inlineSpecialCharacter() : mixed
- inlineStrikethrough() : mixed
- inlineSubscript() : mixed
- inlineSuperscript() : mixed
- inlineUrl() : mixed
- inlineUrlTag() : mixed
- isBlockCompletable() : mixed
- isBlockContinuable() : mixed
- li() : mixed
- lines() : mixed
- paragraph() : mixed
- sanitiseElement() : mixed
- setContentsList() : void
- Set/stores the heading block to ToC list in a string and array format.
- setContentsListAsArray() : void
- Sets/stores the heading block info as an array.
- setContentsListAsString() : void
- Sets/stores the heading block info as a list in markdown format.
- striAtStart() : mixed
- unmarkedText() : mixed
Constants
ID_ATTRIBUTE_DEFAULT
public
mixed
ID_ATTRIBUTE_DEFAULT
= 'toc'
TAG_TOC_DEFAULT
public
mixed
TAG_TOC_DEFAULT
= '[toc]'
version
------------------------------------------------------------------------ Constants.
public
mixed
version
= '1.1.2'
VERSION
public
mixed
VERSION
= '0.0.0'
VERSION_PARSEDOWN_REQUIRED
public
mixed
VERSION_PARSEDOWN_REQUIRED
= '1.7'
Properties
$gfx_fmt
public
mixed
$gfx_fmt
= 'png'
$graphviz_modes
public
static mixed
$graphviz_modes
= ['dot', 'neato', 'fdp', 'sfdp', 'twopi', 'circo']
$headown
public
mixed
$headown
= 0
$BlockTypes
protected
mixed
$BlockTypes
= array('#' => array('Header'), '*' => array('Rule', 'List'), '+' => array('List'), '-' => array('SetextHeader', 'Table', 'Rule', 'List'), '0' => array('List'), '1' => array('List'), '2' => array('List'), '3' => array('List'), '4' => array('List'), '5' => array('List'), '6' => array('List'), '7' => array('List'), '8' => array('List'), '9' => array('List'), ':' => array('Table'), '<' => array('Comment', 'Markup'), '=' => array('SetextHeader'), '>' => array('Quote'), '[' => array('Reference'), '_' => array('Rule'), '`' => array('FencedCode'), '|' => array('Table'), '~' => array('FencedCode'))
$breaksEnabled
protected
mixed
$breaksEnabled
$contentsListArray
protected
mixed
$contentsListArray
= array()
$contentsListString
protected
mixed
$contentsListString
= ''
$DefinitionData
protected
mixed
$DefinitionData
$EmRegex
protected
mixed
$EmRegex
= array('*' => '/^[*]((?:\\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us')
$firstHeadLevel
protected
mixed
$firstHeadLevel
= 0
$inlineMarkerList
protected
mixed
$inlineMarkerList
= '!"*_&[:<>`~\\'
$InlineTypes
protected
mixed
$InlineTypes
= array('"' => array('SpecialCharacter'), '!' => array('Image'), '&' => array('SpecialCharacter'), '*' => array('Emphasis'), ':' => array('Url'), '<' => array('UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'), '>' => array('SpecialCharacter'), '[' => array('Link'), '_' => array('Emphasis'), '`' => array('Code'), '~' => array('Strikethrough'), '\\' => array('EscapeSequence'))
$markupEscaped
protected
mixed
$markupEscaped
$regexHtmlAttribute
protected
mixed
$regexHtmlAttribute
= '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?'
$safeLinksWhitelist
protected
mixed
$safeLinksWhitelist
= array('http://', 'https://', 'ftp://', 'ftps://', 'mailto:', 'data:image/png;base64,', 'data:image/gif;base64,', 'data:image/jpeg;base64,', 'irc:', 'ircs:', 'git:', 'ssh:', 'news:', 'steam:')
$safeMode
protected
mixed
$safeMode
$specialCharacters
protected
mixed
$specialCharacters
= array('\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|')
$StrongRegex
protected
mixed
$StrongRegex
= array('*' => '/^[*]{2}((?:\\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us')
$tag_toc
protected
mixed
$tag_toc
= ''
$textLevelElements
protected
mixed
$textLevelElements
= array('a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', 'i', 'rp', 'del', 'code', 'strike', 'marquee', 'q', 'rt', 'ins', 'font', 'strong', 's', 'tt', 'kbd', 'mark', 'u', 'xm', 'sub', 'nobr', 'sup', 'ruby', 'var', 'span', 'wbr', 'time')
$unmarkedBlockTypes
protected
mixed
$unmarkedBlockTypes
= array('Code')
$urlsLinked
protected
mixed
$urlsLinked
= \true
$voidElements
protected
mixed
$voidElements
= array('area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source')
$instances
private
static mixed
$instances
= array()
Methods
__construct()
Version requirement check.
public
__construct() : mixed
body()
Parses the given markdown string to an HTML string but it leaves the ToC tag as is. It's an alias of the parent method "\DynamicParent::text()".
public
body(string $text) : string
Parameters
- $text : string
-
Markdown string to be parsed.
Return values
string —Parsed HTML string.
contentsList()
Returns the parsed ToC.
public
contentsList([string $type_return = 'string' ]) : string
If the arg is "string" then it returns the ToC in HTML string.
Parameters
- $type_return : string = 'string'
-
Type of the return format. "string" or "json".
Return values
string —HTML/JSON string of ToC.
instance()
public
static instance([mixed $name = 'default' ]) : mixed
Parameters
- $name : mixed = 'default'
line()
public
line(mixed $text[, mixed $nonNestables = array() ]) : mixed
Parameters
- $text : mixed
- $nonNestables : mixed = array()
parse()
public
parse(mixed $text) : mixed
Parameters
- $text : mixed
setBreaksEnabled()
public
setBreaksEnabled(mixed $breaksEnabled) : mixed
Parameters
- $breaksEnabled : mixed
setMarkupEscaped()
public
setMarkupEscaped(mixed $markupEscaped) : mixed
Parameters
- $markupEscaped : mixed
setSafeMode()
public
setSafeMode(mixed $safeMode) : mixed
Parameters
- $safeMode : mixed
setTagToc()
Sets the user defined ToC markdown tag.
public
setTagToc(string $tag) : void
Parameters
- $tag : string
setUrlsLinked()
public
setUrlsLinked(mixed $urlsLinked) : mixed
Parameters
- $urlsLinked : mixed
text()
Parses markdown string to HTML and also the "[toc]" tag as well.
public
text(string $text) : void
It overrides the parent method: \Parsedown::text().
Parameters
- $text : string
blockCode()
protected
blockCode(mixed $Line[, mixed $Block = null ]) : mixed
Parameters
- $Line : mixed
- $Block : mixed = null
blockCodeComplete()
protected
blockCodeComplete(mixed $Block) : mixed
Parameters
- $Block : mixed
blockCodeContinue()
protected
blockCodeContinue(mixed $Line, mixed $Block) : mixed
Parameters
- $Line : mixed
- $Block : mixed
blockComment()
protected
blockComment(mixed $Line) : mixed
Parameters
- $Line : mixed
blockCommentContinue()
protected
blockCommentContinue(mixed $Line, array<string|int, mixed> $Block) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed>
blockFencedCode()
protected
blockFencedCode(mixed $Line) : mixed
Parameters
- $Line : mixed
blockFencedCodeComplete()
protected
blockFencedCodeComplete(mixed $Block) : mixed
Parameters
- $Block : mixed
blockFencedCodeContinue()
protected
blockFencedCodeContinue(mixed $Line, mixed $Block) : mixed
Parameters
- $Line : mixed
- $Block : mixed
blockHeader()
Heading process.
protected
blockHeader(mixed $Line) : void|array<string|int, mixed>
Creates heading block element and stores to the ToC list. It overrides the parent method: \Parsedown::blockHeader() and returns $Block array if the $Line is a heading element.
Parameters
- $Line : mixed
-
Array that Parsedown detected as a block type element.
Return values
void|array<string|int, mixed> —Array of Heading Block.
blockList()
protected
blockList(mixed $Line) : mixed
Parameters
- $Line : mixed
blockListComplete()
protected
blockListComplete(array<string|int, mixed> $Block) : mixed
Parameters
- $Block : array<string|int, mixed>
blockListContinue()
protected
blockListContinue(mixed $Line, array<string|int, mixed> $Block) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed>
blockMarkup()
protected
blockMarkup(mixed $Line) : mixed
Parameters
- $Line : mixed
blockMarkupContinue()
protected
blockMarkupContinue(mixed $Line, array<string|int, mixed> $Block) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed>
blockQuote()
protected
blockQuote(mixed $Line) : mixed
Parameters
- $Line : mixed
blockQuoteContinue()
protected
blockQuoteContinue(mixed $Line, array<string|int, mixed> $Block) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed>
blockReference()
protected
blockReference(mixed $Line) : mixed
Parameters
- $Line : mixed
blockRule()
protected
blockRule(mixed $Line) : mixed
Parameters
- $Line : mixed
blockSetextHeader()
protected
blockSetextHeader(mixed $Line[, array<string|int, mixed> $Block = null ]) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed> = null
blockTable()
protected
blockTable(mixed $Line[, array<string|int, mixed> $Block = null ]) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed> = null
blockTableComplete()
protected
blockTableComplete(array<string|int, mixed> $Block) : mixed
Parameters
- $Block : array<string|int, mixed>
blockTableContinue()
protected
blockTableContinue(mixed $Line, array<string|int, mixed> $Block) : mixed
Parameters
- $Line : mixed
- $Block : array<string|int, mixed>
createAnchorID()
Generates an anchor text that are link-able even the heading is not in ASCII.
protected
createAnchorID(string $text) : string
Parameters
- $text : string
Return values
stringdecodeTagFromHash()
Decodes the hashed ToC tag to an original tag and replaces.
protected
decodeTagFromHash(string $text) : string
This is used to avoid parsing user defined ToC tag which includes "_" in their tag such as "[[toc]]". Unless it will be parsed as: "
[[TOC]]
"Parameters
- $text : string
Return values
stringelement()
protected
element(array<string|int, mixed> $Element) : mixed
Parameters
- $Element : array<string|int, mixed>
elements()
protected
elements(array<string|int, mixed> $Elements) : mixed
Parameters
- $Elements : array<string|int, mixed>
encodeTagToHash()
Encodes the ToC tag to a hashed tag and replace.
protected
encodeTagToHash(string $text) : string
This is used to avoid parsing user defined ToC tag which includes "_" in their tag such as "[[toc]]". Unless it will be parsed as: "
[[TOC]]
"Parameters
- $text : string
Return values
stringescape()
protected
static escape(mixed $text[, mixed $allowQuotes = false ]) : mixed
Parameters
- $text : mixed
- $allowQuotes : mixed = false
fetchText()
Get only the text from a markdown string.
protected
fetchText(string $text) : string
It parses to HTML once then trims the tags to get the text.
Parameters
- $text : string
-
Markdown text.
Return values
stringfilterUnsafeUrlInAttribute()
protected
filterUnsafeUrlInAttribute(array<string|int, mixed> $Element, mixed $attribute) : mixed
Parameters
- $Element : array<string|int, mixed>
- $attribute : mixed
getIdAttributeToC()
Gets the ID attribute of the ToC for HTML tags.
protected
getIdAttributeToC() : string
Return values
stringgetSalt()
Unique string to use as a salt value.
protected
getSalt() : string
Return values
stringgetTagToC()
Gets the markdown tag for ToC.
protected
getTagToC() : string
Return values
stringinlineCode()
protected
inlineCode(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineEmailTag()
protected
inlineEmailTag(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineEmphasis()
protected
inlineEmphasis(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineEscapeSequence()
protected
inlineEscapeSequence(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineForcedBr()
protected
inlineForcedBr(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineImage()
protected
inlineImage(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineInsertedText()
protected
inlineInsertedText(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineKbdText()
protected
inlineKbdText(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineLink()
protected
inlineLink(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineMarkedText()
protected
inlineMarkedText(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineMarkup()
protected
inlineMarkup(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineSpecialCharacter()
protected
inlineSpecialCharacter(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineStrikethrough()
protected
inlineStrikethrough(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineSubscript()
protected
inlineSubscript(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineSuperscript()
protected
inlineSuperscript(mixed $excerpt) : mixed
Parameters
- $excerpt : mixed
inlineUrl()
protected
inlineUrl(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineUrlTag()
protected
inlineUrlTag(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
isBlockCompletable()
protected
isBlockCompletable(mixed $Type) : mixed
Parameters
- $Type : mixed
isBlockContinuable()
protected
isBlockContinuable(mixed $Type) : mixed
Parameters
- $Type : mixed
li()
protected
li(mixed $lines) : mixed
Parameters
- $lines : mixed
lines()
protected
lines(array<string|int, mixed> $lines) : mixed
Parameters
- $lines : array<string|int, mixed>
paragraph()
protected
paragraph(mixed $Line) : mixed
Parameters
- $Line : mixed
sanitiseElement()
protected
sanitiseElement(array<string|int, mixed> $Element) : mixed
Parameters
- $Element : array<string|int, mixed>
setContentsList()
Set/stores the heading block to ToC list in a string and array format.
protected
setContentsList(array<string|int, mixed> $Content) : void
Parameters
- $Content : array<string|int, mixed>
-
Heading info such as "level","id" and "text".
setContentsListAsArray()
Sets/stores the heading block info as an array.
protected
setContentsListAsArray(array<string|int, mixed> $Content) : void
Parameters
- $Content : array<string|int, mixed>
setContentsListAsString()
Sets/stores the heading block info as a list in markdown format.
protected
setContentsListAsString(array<string|int, mixed> $Content) : void
Parameters
- $Content : array<string|int, mixed>
-
Heading info such as "level","id" and "text".
striAtStart()
protected
static striAtStart(mixed $string, mixed $needle) : mixed
Parameters
- $string : mixed
- $needle : mixed
unmarkedText()
protected
unmarkedText(mixed $text) : mixed
Parameters
- $text : mixed