Cecil

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
$cacheBuildId  : string|null
$config  : Config
$highlighter  : Highlighter
Shared across all instances: registerAllLanguages() scans 185 files but $classMap is static
$imageProcessingCache  : array<string, mixed>
$language  : string|null
$regexAttribute  : 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
{@inheritdoc}
inlineCode()  : mixed
{@inheritdoc}
inlineImage()  : mixed
{@inheritdoc}
inlineInsert()  : mixed
Insert inline.
inlineLink()  : mixed
{@inheritdoc}
inlineUrl()  : mixed
{@inheritdoc}
inlineUrlTag()  : mixed
{@inheritdoc}
parseAttributeData()  : mixed
{@inheritdoc}
unmarkedText()  : string
{@inheritdoc}
createEmbeddedVideoFromLink()  : array<string|int, mixed>
Create an embedded video iframe element from a link element and an URL.
createFigure()  : array<string|int, mixed>
Create a figure > figcaption element.
createMediaFromLink()  : array<string|int, mixed>
Create a media (video or audio) element from a link.
createScriptFromLink()  : array<string|int, mixed>
Create a script element from a link element and an URL.
getAssetIdentity()  : string
getCachedAsset()  : Asset
getCachedDarkSourceAttributes()  : array<string|int, mixed>
getCachedDominantColor()  : string
getCachedLqip()  : string
getCachedSizes()  : string
getCachedSrcset()  : string
getCachedSrcsetW()  : string
getCacheKey()  : string
handleExternalLink()  : array<string|int, mixed>
Handle an external link.
isAnimatedGifCached()  : bool
normalizePath()  : string
Turns a path relative to static or assets into a website relative path.
rememberAsset()  : Asset
Memoize an Asset instance across Parsedown instances.
rememberImageProcessing()  : mixed
Memoize an image-processing result across Parsedown instances.

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

$cacheBuildId

protected static string|null $cacheBuildId = null

Cache scope marker so static caches can be reset between builds.

$highlighter

Shared across all instances: registerAllLanguages() scans 185 files but $classMap is static

protected static Highlighter $highlighter

$imageProcessingCache

protected static array<string, mixed> $imageProcessingCache = []

Stores image processing results to avoid redundant computations within a build.

$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
string

inlineCode()

{@inheritdoc}

protected inlineCode(mixed $Excerpt) : mixed
Parameters
$Excerpt : mixed

inlineImage()

{@inheritdoc}

protected inlineImage(mixed $Excerpt) : mixed
Parameters
$Excerpt : mixed

inlineInsert()

Insert inline.

protected inlineInsert(mixed $Excerpt) : mixed

e.g.: ++text++ -> text.

Parameters
$Excerpt : mixed

{@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
string

Create an embedded video iframe element from a link element and an URL.

private createEmbeddedVideoFromLink(array<string|int, mixed> $link, string $url) : array<string|int, mixed>
Parameters
$link : array<string|int, mixed>
$url : string
Return values
array<string|int, mixed>

createFigure()

Create a figure > figcaption element.

private createFigure(array<string|int, mixed> $inline) : array<string|int, mixed>
Parameters
$inline : array<string|int, mixed>
Return values
array<string|int, mixed>

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>

Create a script element from a link element and an URL.

private createScriptFromLink(array<string|int, mixed> $link, string $url) : array<string|int, mixed>
Parameters
$link : array<string|int, mixed>
$url : string
Return values
array<string|int, mixed>

getAssetIdentity()

private getAssetIdentity(Asset $asset) : string
Parameters
$asset : Asset
Return values
string

getCachedAsset()

private getCachedAsset(string $path, array<string|int, mixed> $assetOptions) : Asset
Parameters
$path : string
$assetOptions : array<string|int, mixed>
Return values
Asset

getCachedDarkSourceAttributes()

private getCachedDarkSourceAttributes(Asset $asset, string $darkSuffix, array<string|int, mixed> $formats, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$asset : Asset
$darkSuffix : string
$formats : array<string|int, mixed>
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

getCachedDominantColor()

private getCachedDominantColor(Asset $asset) : string
Parameters
$asset : Asset
Return values
string

getCachedLqip()

private getCachedLqip(Asset $asset) : string
Parameters
$asset : Asset
Return values
string

getCachedSizes()

private getCachedSizes(string $class, array<string|int, mixed> $sizesConfig) : string
Parameters
$class : string
$sizesConfig : array<string|int, mixed>
Return values
string

getCachedSrcset()

private getCachedSrcset(Asset $asset, array<string|int, mixed> $widths) : string
Parameters
$asset : Asset
$widths : array<string|int, mixed>
Return values
string

getCachedSrcsetW()

private getCachedSrcsetW(Asset $asset, array<string|int, mixed> $widths) : string
Parameters
$asset : Asset
$widths : array<string|int, mixed>
Return values
string

getCacheKey()

private getCacheKey(string $prefix, array<string|int, mixed> $payload) : string
Parameters
$prefix : string
$payload : array<string|int, mixed>
Return values
string

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>

isAnimatedGifCached()

private isAnimatedGifCached(Asset $asset) : bool
Parameters
$asset : Asset
Return values
bool

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
Return values
string

rememberAsset()

Memoize an Asset instance across Parsedown instances.

private rememberAsset(array<string|int, mixed> $payload, callable $factory) : Asset
Parameters
$payload : array<string|int, mixed>
$factory : callable
Return values
Asset

rememberImageProcessing()

Memoize an image-processing result across Parsedown instances.

private rememberImageProcessing(string $prefix, array<string|int, mixed> $payload, callable $factory) : mixed
Parameters
$prefix : string
$payload : array<string|int, mixed>
$factory : callable
On this page

Search results