Properties
|
protected
cebe\markdown\Parser
::
$context
-
var
array
the current context the parser is in.
TODO remove in favor of absy
|
protected
$escapeCharacters
|
protected
cebe\markdown\Markdown
::
$inlineHtmlElements
-
var
array
HTML elements considered as inline elements.
-
see
http://www.w3.org/wiki/HTML/Elements#Text-level_semantics
|
protected
cebe\markdown\Markdown
::
$references
-
var
array
a list of defined references in this document.
|
protected
cebe\markdown\Markdown
::
$selfClosingHtmlElements
-
var
array
HTML elements known to be self-closing.
|
Methods
|
protected
cebe\markdown\Parser
::
blockTypes
()
-
return
array
a list of block element types available.
|
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"
-
return
string
the complete table HTML.
-
since
1.2.0
|
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
consumeParagraph
(
$lines
,
$current
)
Consume lines for a paragraph
Allow headlines, lists and code to break paragraphs
|
protected
cebe\markdown\Markdown
::
consumeQuote
(
$lines
,
$current
)
Consume lines for a blockquote element
|
protected
cebe\markdown\Markdown
::
consumeReference
(
$lines
,
$current
)
|
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.
-
return
string
name of the block type in lower case
|
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
cebe\markdown\Markdown
::
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.
-
return
array
a map of markers to parser methods
|
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
-
return
array
Array of two elements, the first element contains the block,
the second contains the next line index to be parsed.
|
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.
|
protected
cebe\markdown\Markdown
::
parseEntity
(
$text
)
Parses an & or a html entity definition.
|
protected
cebe\markdown\Parser
::
parseEscape
(
$text
)
Parses escaped special characters.
|
protected
cebe\markdown\Markdown
::
parseGt
(
$text
)
|
protected
cebe\markdown\Markdown
::
parseImage
(
$markdown
)
Parses an image indicated by ![ .
|
protected
cebe\markdown\Parser
::
parseInline
(
$text
)
Parses inline elements of the language.
|
protected
cebe\markdown\Markdown
::
parseInlineCode
(
$text
)
Parses an inline code span ` .
|
protected
cebe\markdown\Markdown
::
parseLink
(
$markdown
)
Parses a link indicated by [ .
|
protected
cebe\markdown\Markdown
::
parseLinkOrImage
(
$markdown
) |
protected
cebe\markdown\Markdown
::
parseLt
(
$text
)
|
protected
parseStrike
(
$markdown
)
Parses the strikethrough feature.
|
protected
parseTd
(
$markdown
)
|
protected
parseUrl
(
$markdown
)
Parses urls and adds auto linking feature.
|
protected
cebe\markdown\Markdown
::
prepare
()
|
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
renderAutoUrl
(
$block
) |
protected
renderCode
(
$block
)
|
protected
cebe\markdown\Markdown
::
renderEmail
(
$block
) |
protected
cebe\markdown\Markdown
::
renderEmph
(
$block
) |
protected
cebe\markdown\Markdown
::
renderHeadline
(
$block
)
|
protected
cebe\markdown\Markdown
::
renderHr
(
$block
)
Renders a horizontal rule
|
protected
cebe\markdown\Markdown
::
renderHtml
(
$block
)
|
protected
cebe\markdown\Markdown
::
renderImage
(
$block
) |
protected
cebe\markdown\Markdown
::
renderInlineCode
(
$block
) |
protected
cebe\markdown\Markdown
::
renderInlineHtml
(
$block
)
|
protected
cebe\markdown\Markdown
::
renderLink
(
$block
) |
protected
cebe\markdown\Markdown
::
renderList
(
$block
)
|
protected
cebe\markdown\Parser
::
renderParagraph
(
$block
)
|
protected
cebe\markdown\Markdown
::
renderQuote
(
$block
)
|
protected
renderStrike
(
$block
) |
protected
cebe\markdown\Markdown
::
renderStrong
(
$block
) |
protected
renderTable
(
$block
)
|
protected
renderText
(
$text
)
-
inheritdocs
Parses a newline indicated by two spaces on the end of a markdown line.
|
protected
cebe\markdown\Markdown
::
renderUrl
(
$block
) |
protected
cebe\markdown\Markdown
::
replaceEscape
(
$text
)
Remove backslash from escaped characters
|