EmbedTrait
Table of Contents
Properties
- $embedProvider : EmbedProvider|null
- An EmbedProvider that can provide an unpacked embed code to the parser.
- $EMBED_PATTERN : string
- The regex pattern used to identify embed blocks.
Methods
- consumeEmbed() : array<string|int, mixed>
- Parse an embed directive.
- identifyEmbed() : bool
- Identify an Embed directive.
- renderEmbed() : string
- Render the embed code.
Properties
$embedProvider
An EmbedProvider that can provide an unpacked embed code to the parser.
protected
EmbedProvider|null
$embedProvider
= null
$EMBED_PATTERN
The regex pattern used to identify embed blocks.
private
static string
$EMBED_PATTERN
= '/^:\\[(.+)\\]\\((.+)\\)$/'
Methods
consumeEmbed()
Parse an embed directive.
protected
consumeEmbed(array<string|int, mixed> $lines, int $current) : array<string|int, mixed>
Parameters
- $lines : array<string|int, mixed>
-
Array of lines of the Markdown document.
- $current : int
-
Current line.
Return values
array<string|int, mixed> —Parsing information.
identifyEmbed()
Identify an Embed directive.
protected
identifyEmbed(string $line) : bool
Parameters
- $line : string
-
Current line being parsed.
Return values
boolrenderEmbed()
Render the embed code.
protected
renderEmbed(array<string|int, mixed> $block) : string
Parameters
- $block : array<string|int, mixed>
-
Block data.