Parsedown extends ParsedownToc
Parsedown class. This class extends ParsedownExtra (and ParsedownToc) and provides methods to parse Markdown content with additional features such as inline insertions, image handling, note blocks, and code highlighting.
Table of Contents
Properties
- $BlockTypes : array<string|int, mixed>
- $inlineMarkerList : string
- $InlineTypes : array<string|int, mixed>
- $specialCharacters : array<string|int, mixed>
- $builder : Builder
- $config : Config
- $highlighter : Highlighter
- $regexAttribute : string
- $inlineMarkerList : string
- Regex for attributes.
- $regexImage : string
- Regex for image block.
Methods
- __construct() : mixed
- blockFencedCodeComplete() : mixed
- Apply Highlight to code blocks.
- blockImage() : mixed
- Image block.
- blockNote() : mixed
- Note block-level markup.
- blockNoteComplete() : mixed
- blockNoteContinue() : mixed
- element() : string
- blockNoteContinue() : mixed
- {@inheritdoc}
- inlineImage() : mixed
- {@inheritdoc}
- inlineInsert() : mixed
- Insert inline.
- inlineLink() : mixed
- {@inheritdoc}
- inlineUrl() : mixed
- {@inheritdoc}
- inlineUrlTag() : mixed
- {@inheritdoc}
- parseAttributeData() : mixed
- {@inheritdoc}
- unmarkedText() : string
- {@inheritdoc}
- createFigure() : array<string|int, mixed>
- Create a figure / caption element.
- createMediaFromLink() : array<string|int, mixed>
- Create a media (video or audio) element from a link.
- handleExternalLink() : array<string|int, mixed>
- Handle an external link.
- normalizePath() : string
- Turns a path relative to static or assets into a website relative path.
Properties
$BlockTypes
public
array<string|int, mixed>
$BlockTypes
$inlineMarkerList
public
string
$inlineMarkerList
$InlineTypes
public
array<string|int, mixed>
$InlineTypes
$specialCharacters
public
array<string|int, mixed>
$specialCharacters
$builder
protected
Builder
$builder
$config
protected
Config
$config
$highlighter
protected
Highlighter
$highlighter
$regexAttribute
Regex for attributes.
protected
string
$regexAttribute
= '(?:[#.][-\w:\\\\]+[ ]*|[-\w:\\\\]+(?:=(?:["\'][^\n]*?["\']|[^\s]+)?)?[ ]*)'
$regexImage
Regex for image block.
protected
string
$regexImage
= "~^!\\[.*?\\]\\(.*?\\)~"
Methods
__construct()
public
__construct(Builder $builder[, array<string|int, mixed>|null $options = null ]) : mixed
Parameters
- $builder : Builder
- $options : array<string|int, mixed>|null = null
blockFencedCodeComplete()
Apply Highlight to code blocks.
protected
blockFencedCodeComplete(mixed $block) : mixed
Parameters
- $block : mixed
blockImage()
Image block.
protected
blockImage(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
blockNote()
Note block-level markup.
protected
blockNote(mixed $block) : mixed
:::tip Tip: This is an advice. :::
Code inspired by https://github.com/sixlive/parsedown-alert from TJ Miller (@sixlive).
Parameters
- $block : mixed
blockNoteComplete()
protected
blockNoteComplete(mixed $block) : mixed
Parameters
- $block : mixed
blockNoteContinue()
protected
blockNoteContinue(mixed $line, mixed $block) : mixed
Parameters
- $line : mixed
- $block : mixed
element()
{@inheritdoc}
protected
element(array<string|int, mixed> $Element) : string
XHTML closing tag to HTML5 closing tag.
Parameters
- $Element : array<string|int, mixed>
Return values
stringinlineImage()
{@inheritdoc}
protected
inlineImage(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineInsert()
Insert inline.
protected
inlineInsert(mixed $Excerpt) : mixed
e.g.: ++text++ -> text.
Parameters
- $Excerpt : mixed
inlineLink()
{@inheritdoc}
protected
inlineLink(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineUrl()
{@inheritdoc}
protected
inlineUrl(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
inlineUrlTag()
{@inheritdoc}
protected
inlineUrlTag(mixed $Excerpt) : mixed
Parameters
- $Excerpt : mixed
parseAttributeData()
{@inheritdoc}
protected
parseAttributeData(mixed $attributeString) : mixed
Parameters
- $attributeString : mixed
unmarkedText()
{@inheritdoc}
protected
unmarkedText(mixed $text) : string
Converts XHTML '
' tag to '
'.
Parameters
- $text : mixed
Return values
stringcreateFigure()
Create a figure / caption element.
private
createFigure(array<string|int, mixed> $inline) : array<string|int, mixed>
Parameters
- $inline : array<string|int, mixed>
Return values
array<string|int, mixed>createMediaFromLink()
Create a media (video or audio) element from a link.
private
createMediaFromLink(array<string|int, mixed> $link[, string $type = 'video' ]) : array<string|int, mixed>
Parameters
- $link : array<string|int, mixed>
- $type : string = 'video'
Return values
array<string|int, mixed>handleExternalLink()
Handle an external link.
private
handleExternalLink(array<string|int, mixed> $link) : array<string|int, mixed>
Parameters
- $link : array<string|int, mixed>
Return values
array<string|int, mixed>normalizePath()
Turns a path relative to static or assets into a website relative path.
private
normalizePath(string $path) : string
"../../assets/images/img.jpeg" -> "/images/img.jpeg"
Parameters
- $path : string