Copied!
CloneableInstantiable
Properties
public $codeAttributesOnPre
 
  • var phpDocumentor\Reflection\Types\Boolean whether special attributes on code blocks should be applied on the <pre> element.
    The default behavior is to put them on the <code> element.
public cebe\markdown\Markdown::$html5
 
public cebe\markdown\Markdown::$keepListStartNumber
 
  • var phpDocumentor\Reflection\Types\Boolean enable support start attribute of ordered lists. This means that lists
    will start with the number you actually type in markdown and not the HTML generated one.
    Defaults to false which means that numeration of all ordered lists(<ol>) starts with 1.
public cebe\markdown\Parser::$maximumNestingLevel
 
Methods
public cebe\markdown\Parser::parse( $text)
 

Parses the given text considering the full language.

This includes parsing block elements as well as inline elements.

public cebe\markdown\Parser::parseParagraph( $text)
 

Parses a paragraph without block elements (block elements are ignored).

Properties
protected cebe\markdown\Parser::$context
 
protected $escapeCharacters
 
  • inheritDoc
protected cebe\markdown\Markdown::$inlineHtmlElements
 
protected cebe\markdown\Markdown::$references
 
protected cebe\markdown\Markdown::$selfClosingHtmlElements
 
Methods
protected cebe\markdown\Parser::blockTypes()
 
protected cebe\markdown\Parser::cleanup()
 

This method will be called after parse() and parseParagraph().

You can override it to do cleanup.

protected composeTable( $head, $body)
 

This method composes a table from parsed body and head HTML.

You may override this method to customize the table rendering, for example by
adding a class to the table tag:

return "<table class="table table-striped">\n<thead>\n$head</thead>\n<tbody>\n$body</tbody>\n</table>\n"
protected cebe\markdown\Markdown::consumeAHr( $lines, $current)
 

Consume a horizontal rule

protected cebe\markdown\Markdown::consumeBUl( $lines, $current)
 

Consume lines for an unordered list

protected consumeCode( $lines, $current)
 

Consume lines for a code block element

protected consumeFencedCode( $lines, $current)
 

Consume lines for a fenced code block

protected cebe\markdown\Markdown::consumeHeadline( $lines, $current)
 

Consume lines for a headline

protected cebe\markdown\Markdown::consumeHr( $lines, $current)
 

Consume a horizontal rule

protected cebe\markdown\Markdown::consumeHtml( $lines, $current)
 

Consume lines for an HTML block

protected cebe\markdown\Markdown::consumeOl( $lines, $current)
 

Consume lines for an ordered list

protected cebe\markdown\Markdown::consumeParagraph( $lines, $current)
 

Consume lines for a paragraph

Allow headlines and code to break paragraphs

protected cebe\markdown\Markdown::consumeQuote( $lines, $current)
 

Consume lines for a blockquote element

protected consumeReference( $lines, $current)
 

Consume link references

protected consumeTable( $lines, $current)
 

Consume lines for a table

protected cebe\markdown\Markdown::consumeUl( $lines, $current)
 

Consume lines for an unordered list

protected cebe\markdown\Parser::detectLineType( $lines, $current)
 

Given a set of lines and an index of a current line it uses the registed block types to
detect the type of this line.

protected cebe\markdown\Markdown::identifyAHr( $line)
 

identify a line as a horizontal rule.

protected cebe\markdown\Markdown::identifyBUl( $line)
 

identify a line as the beginning of an unordered list.

protected identifyCode( $line)
 

identify a line as the beginning of a code block.

protected identifyFencedCode( $line)
 

identify a line as the beginning of a fenced code block.

protected cebe\markdown\Markdown::identifyHeadline( $line, $lines, $current)
 

identify a line as a headline

protected cebe\markdown\Markdown::identifyHr( $line)
 

identify a line as a horizontal rule.

protected cebe\markdown\Markdown::identifyHtml( $line, $lines, $current)
 

identify a line as the beginning of a HTML block.

protected cebe\markdown\Markdown::identifyOl( $line)
 

identify a line as the beginning of an ordered list.

protected cebe\markdown\Markdown::identifyQuote( $line)
 

identify a line as the beginning of a block quote.

protected identifyReference( $line)
protected identifyTable( $line, $lines, $current)
 

identify a line as the beginning of a table block.

protected cebe\markdown\Markdown::identifyUl( $line)
 

identify a line as the beginning of an unordered list.

protected cebe\markdown\Parser::inlineMarkers()
 

Returns a map of inline markers to the corresponding parser methods.

This array defines handler methods for inline markdown markers.
When a marker is found in the text, the handler method is called with the text
starting at the position of the marker.

Note that markers starting with whitespace may slow down the parser,
you may want to use [[renderText]] to deal with them.

You may override this method to define a set of markers and parsing methods.
The default implementation looks for protected methods starting with parse that
also have an @marker annotation in PHPDoc.

protected cebe\markdown\Markdown::lookupReference( $key)
protected cebe\markdown\Parser::parseBlock( $lines, $current)
 

Parses the block at current line by identifying the block type and parsing the content

protected cebe\markdown\Parser::parseBlocks( $lines)
 

Parse block elements by calling detectLineType() to identify them
and call consume function afterwards.

protected cebe\markdown\Markdown::parseEmphStrong( $text)
 

Parses emphasized and strong elements.

  • marker _
  • marker *
protected cebe\markdown\Markdown::parseEntity( $text)
 

Parses an & or a html entity definition.

  • marker &
protected cebe\markdown\Parser::parseEscape( $text)
 

Parses escaped special characters.

  • marker \
protected cebe\markdown\Markdown::parseGt( $text)
 

Escapes > characters.

  • marker >
protected cebe\markdown\Markdown::parseImage( $markdown)
 

Parses an image indicated by ![.

  • marker ![
protected parseInline( $text)
protected cebe\markdown\Markdown::parseInlineCode( $text)
 

Parses an inline code span `.

  • marker `
protected cebe\markdown\Markdown::parseLink( $markdown)
 

Parses a link indicated by [.

  • marker [
protected cebe\markdown\Markdown::parseLinkOrImage( $markdown)
protected cebe\markdown\Markdown::parseLt( $text)
 

Parses inline HTML.

  • marker <
protected parseSpecialAttributes( $text)
 
  • marker {
protected parseTd( $markdown)
 
  • marker |
protected cebe\markdown\Markdown::prepare()
 

You can override it to do some initialization work.

protected cebe\markdown\Parser::prepareMarkers( $text)
 

Prepare markers that are used in the text to parse

Add all markers that are present in markdown.
Check is done to avoid iterations in parseInline(), good for huge markdown files

protected cebe\markdown\Parser::renderAbsy( $blocks)
protected renderAttributes( $block)
protected renderCode( $block)
protected cebe\markdown\Markdown::renderEmail( $block)
protected cebe\markdown\Markdown::renderEmph( $block)
protected renderHeadline( $block)
 

Renders a headline

protected cebe\markdown\Markdown::renderHr( $block)
 

Renders a horizontal rule

protected cebe\markdown\Markdown::renderHtml( $block)
 

Renders an HTML block

protected renderImage( $block)
protected cebe\markdown\Markdown::renderInlineCode( $block)
protected cebe\markdown\Markdown::renderInlineHtml( $block)
 

renders a html entity.

protected renderLink( $block)
protected cebe\markdown\Markdown::renderList( $block)
 

Renders a list

protected cebe\markdown\Parser::renderParagraph( $block)
 

Render a paragraph block

protected cebe\markdown\Markdown::renderQuote( $block)
 

Renders a blockquote

protected renderSpecialAttributes( $block)
protected cebe\markdown\Markdown::renderStrong( $block)
protected renderTable( $block)
 

render a table block

protected cebe\markdown\Markdown::renderText( $text)
 

It can be used to work on normal text sections for example to highlight keywords or
do special escaping.

protected cebe\markdown\Markdown::renderUrl( $block)
protected cebe\markdown\Markdown::replaceEscape( $text)
 

Remove backslash from escaped characters

Properties
private $_specialAttributesRegex
© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration