MarkdownParser
in package
implements
MarkdownParserInterface
FinalYes
Table of Contents
Interfaces
Properties
- $activeBlockParsers : array<int, BlockContinueParserInterface>
- $closedBlockParsers : array<int, BlockContinueParserWithInlinesInterface>
- $cursor : Cursor
- $environment : EnvironmentInterface
- $lineNumber : int
- $maxNestingLevel : int
- $referenceMap : ReferenceMap
Methods
- __construct() : mixed
- getActiveBlockParser() : BlockContinueParserInterface
- parse() : Document
- activateBlockParser() : void
- addChild() : BlockContinueParserInterface
- Add block of type tag as a child of the tip. If the tip can't accept children, close and finalize it and try its parent, and so on til we find a block that can accept children.
- closeBlockParsers() : void
- deactivateBlockParser() : BlockContinueParserInterface
- finalize() : void
- Finalize a block. Close it and do any necessary postprocessing, e.g. creating string_content from strings, setting the 'tight' or 'loose' status of a list, and parsing the beginnings of paragraphs for reference definitions.
- findBlockStart() : BlockStart|null
- initialize() : void
- parseBlockContinuation() : int|null
- parseLine() : void
- Analyze a line of text and update the document appropriately. We parse markdown text by calling this on each line of input, then finalizing the document.
- prepareActiveBlockParserForReplacement() : int|null
- processInlines() : void
- Walk through a block & children recursively, parsing string content into inline content where appropriate.
- updateReferenceMap() : void
Properties
$activeBlockParsers
private
array<int, BlockContinueParserInterface>
$activeBlockParsers
= []
Tags
$closedBlockParsers
private
array<int, BlockContinueParserWithInlinesInterface>
$closedBlockParsers
= []
Tags
$cursor
private
Cursor
$cursor
Tags
$environment
private
EnvironmentInterface
$environment
Tags
$lineNumber
private
int
$lineNumber
= 0
Tags
$maxNestingLevel
private
int
$maxNestingLevel
Tags
$referenceMap
private
ReferenceMap
$referenceMap
Tags
Methods
__construct()
public
__construct(EnvironmentInterface $environment) : mixed
Parameters
- $environment : EnvironmentInterface
getActiveBlockParser()
public
getActiveBlockParser() : BlockContinueParserInterface
Tags
Return values
BlockContinueParserInterfaceparse()
public
parse(string $input) : Document
Parameters
- $input : string
Tags
Return values
DocumentactivateBlockParser()
private
activateBlockParser(BlockContinueParserInterface $blockParser) : void
Parameters
- $blockParser : BlockContinueParserInterface
addChild()
Add block of type tag as a child of the tip. If the tip can't accept children, close and finalize it and try its parent, and so on til we find a block that can accept children.
private
addChild(BlockContinueParserInterface $blockParser[, int|null $startLineNumber = null ]) : BlockContinueParserInterface
Parameters
- $blockParser : BlockContinueParserInterface
- $startLineNumber : int|null = null
Return values
BlockContinueParserInterfacecloseBlockParsers()
private
closeBlockParsers(int $count, int $endLineNumber) : void
Parameters
- $count : int
- $endLineNumber : int
deactivateBlockParser()
private
deactivateBlockParser() : BlockContinueParserInterface
Tags
Return values
BlockContinueParserInterfacefinalize()
Finalize a block. Close it and do any necessary postprocessing, e.g. creating string_content from strings, setting the 'tight' or 'loose' status of a list, and parsing the beginnings of paragraphs for reference definitions.
private
finalize(BlockContinueParserInterface $blockParser, int $endLineNumber) : void
Parameters
- $blockParser : BlockContinueParserInterface
- $endLineNumber : int
findBlockStart()
private
findBlockStart(BlockContinueParserInterface $lastMatchedBlockParser) : BlockStart|null
Parameters
- $lastMatchedBlockParser : BlockContinueParserInterface
Return values
BlockStart|nullinitialize()
private
initialize() : void
parseBlockContinuation()
private
parseBlockContinuation() : int|null
Return values
int|nullparseLine()
Analyze a line of text and update the document appropriately. We parse markdown text by calling this on each line of input, then finalizing the document.
private
parseLine(string $line) : void
Parameters
- $line : string
prepareActiveBlockParserForReplacement()
private
prepareActiveBlockParserForReplacement() : int|null
Return values
int|null —The line number where the old block started
processInlines()
Walk through a block & children recursively, parsing string content into inline content where appropriate.
private
processInlines(int $inputSize) : void
Parameters
- $inputSize : int
updateReferenceMap()
private
updateReferenceMap(array<string|int, ReferenceInterface> $references) : void
Parameters
- $references : array<string|int, ReferenceInterface>