Свойство | Type | Description | |
---|---|---|---|
$allowMixedChildren | array |
html block tags that allow inline & block children | |
$bodyWidth | integer | wrap output, set to 0 to skip wrapping | |
$buffer | array |
stores current buffers | |
$drop | array |
html tags to be dropped (contents will not be parsed!) | |
$escapeInText | array | list of chars which have to be escaped in normal text | |
$footnotes | array |
stores current buffers | |
$ignore | array |
html tags to be ignored (contents will be parsed) | |
$indent | string | current indentation | |
$isMarkdownable | array |
tags with elements which can be handled by markdown | |
$keepHTML | boolean | keep html tags which cannot be converted to markdown | |
$lastClosedTag | string | name of last closed tag | |
$lastWasBlockTag | boolean | wether last processed node was a block tag or not | |
$lineBreaks | number of line breaks before next inline output | ||
$linkPosition | integer | position where the link reference will be displayed | |
$minBodyWidth | integer | minimum body width | |
$notConverted | array |
stack with tags which where not converted to html | |
$output | string | markdown output | |
$parser | parseHTML | html parser object | |
$skipConversion | boolean | skip conversion to markdown | |
$stack | array |
node stack, e.g. for and tags | |
$wrappableIndents | array |
Markdown indents which could be wrapped |
Méthode | Description | |
---|---|---|
__construct ( integer $linkPosition = self::LINK_AFTER_CONTENT, integer $bodyWidth = MDFY_BODYWIDTH, boolean $keepHTML = MDFY_KEEPHTML ) : void | constructor, set options, setup parser | |
parseString ( string $html ) : string | parse a HTML string | |
setKeepHTML ( $keepHTML ) : void | set keep HTML tags which cannot be converted to markdown | |
setLinkPosition ( integer $linkPosition ) : void | set the position where the link reference will be displayed |
Méthode | Description | |
---|---|---|
_decode_hex ( array $matches ) : string | callback for decode() which converts a hexadecimal entity to UTF-8 | |
_decode_numeric ( array $matches ) : string | callback for decode() which converts a numerical entity to UTF-8 | |
buffer ( ) : void | buffer next parser output until unbuffer() is called | |
decode ( $text, $quote_style = ENT_QUOTES ) | decode email addresses | |
fixBlockElementSpacing ( ) | Trims whitespace in block-level elements, on the left side. | |
fixInlineElementSpacing ( ) | Moves leading/trailing whitespace from inline elements outside of the element. This is to fix cases like Text, which if converted to ** strong** would be incorrect Markdown. | |
flushFootnotes ( ) : void | output footnotes | |
flushLinebreaks ( ) : void | flush enqued linebreaks | |
getLinkReference ( array $tag ) : string | return formated link reference | |
getStacked ( string $tagName ) : array | get last stacked element of type $tagName | |
handleHeader ( integer $level ) : void |
handle header tags (-) |
|
handleTagToText ( ) : void | handle non Markdownable tags | |
handleTag_a ( ) : void | handle tags | |
handleTag_a_converter ( array $tag, string $buffer ) : string | handle tags conversion | |
handleTag_a_parser ( ) : void | handle tags parsing | |
handleTag_b ( ) | ||
handleTag_blockquote ( ) : void |
handle tags |
|
handleTag_br ( ) : void |
handle tags |
|
handleTag_code ( ) : void |
handle tags |
|
handleTag_em ( ) : void | handle and tags | |
handleTag_h1 ( ) : void |
handle tags |
|
handleTag_h2 ( ) : void |
handle tags |
|
handleTag_h3 ( ) : void |
handle tags |
|
handleTag_h4 ( ) : void |
handle tags |
|
handleTag_h5 ( ) : void |
handle tags |
|
handleTag_h6 ( ) : void |
handle tags |
|
handleTag_hr ( ) : void |
handle tags |
|
handleTag_i ( ) | ||
handleTag_img ( ) : void | handle tags | |
handleTag_li ( ) : void |
handle |
|
handleTag_ol ( ) : void |
handle
|
|
handleTag_p ( ) : void |
handle tags |
|
handleTag_pre ( ) : void |
handle tags |
|
handleTag_strong ( ) : void | handle and tags | |
handleTag_ul ( ) : void |
handle
|
|
handleText ( ) : void | handle plain text | |
hasParent ( string $tagName ) : boolean | check if current node has a $tagName as parent (somewhere, not only the direct parent) | |
indent ( string $str, boolean $output = true ) : void | indent next output (start tag) or unindent (end tag) | |
isMarkdownable ( ) : boolean | check if current tag can be converted to Markdown | |
out ( string $put, boolean $nowrap = false ) : void | append string to the correct var, either directly to $this->output or to the current buffers | |
parent ( ) : string | get tagName of direct parent tag | |
parse ( ) : void | iterate through the nodes and decide what we shall do with the current node | |
resetState ( ) | Resetting the state forces the instance to behave as a fresh instance. | |
setLineBreaks ( integer $number ) : void | set number of line breaks before next start tag | |
stack ( ) : void | add current node to the stack this only stores the attributes | |
strlen ( string $str ) : integer | UTF-8 strlen() | |
unbuffer ( ) : string | end current buffer and return buffered output | |
unichr ( $dec ) : string | UTF-8 chr() which supports numeric entities | |
unstack ( ) : array | remove current tag from stack | |
wordwrap ( string $str, $width, $break, $cut = false ) : string | wordwrap for utf8 encoded strings |
public __construct ( integer $linkPosition = self::LINK_AFTER_CONTENT, integer $bodyWidth = MDFY_BODYWIDTH, boolean $keepHTML = MDFY_KEEPHTML ) : void | ||
$linkPosition | integer | define the position of links |
$bodyWidth | integer | whether or not to wrap the output to the given width defaults to false |
$keepHTML | boolean | whether to keep non markdownable HTML or to discard it defaults to true (HTML will be kept) |
Résultat | void |
protected _decode_hex ( array $matches ) : string | ||
$matches | array | |
Résultat | string | UTF-8 encoded |
protected _decode_numeric ( array $matches ) : string | ||
$matches | array | |
Résultat | string | UTF-8 encoded |
protected decode ( $text, $quote_style = ENT_QUOTES ) |
protected fixBlockElementSpacing ( ) |
protected fixInlineElementSpacing ( ) |
protected flushFootnotes ( ) : void | ||
Résultat | void |
protected flushLinebreaks ( ) : void | ||
Résultat | void |
protected getLinkReference ( array $tag ) : string | ||
$tag | array | |
Résultat | string | link reference |
protected getStacked ( string $tagName ) : array | ||
$tagName | string | |
Résultat | array |
protected handleHeader ( integer $level ) : void | ||
$level | integer | 1-6 |
Résultat | void |
protected handleTagToText ( ) : void | ||
Résultat | void |
tags
protected handleTag_blockquote ( ) : void | ||
Résultat | void |
handle and tags
protected handleTag_strong ( ) : void
Résultat
void
check if current node has a $tagName as parent (somewhere, not only the direct parent)
indent next output (start tag) or unindent (end tag)
check if current tag can be converted to Markdown
protected isMarkdownable ( ) : boolean
Résultat
boolean
append string to the correct var, either
directly to $this->output or to the current
buffers
get tagName of direct parent tag
iterate through the nodes and decide what we
shall do with the current node
parse a HTML string
public parseString ( string $html ) : string
$html
string
Résultat
string
markdown formatted
Ideal for running within a loop where you want to maintain a single instance.
protected resetState ( )
set keep HTML tags which cannot be converted to markdown
public setKeepHTML ( $keepHTML ) : void
Résultat
void
set number of line breaks before next start tag
protected setLineBreaks ( integer $number ) : void
$number
integer
Résultat
void
set the position where the link reference will be displayed
public setLinkPosition ( integer $linkPosition ) : void
$linkPosition
integer
Résultat
void
add current node to the stack
this only stores the attributes
UTF-8 strlen()
end current buffer and return buffered output
UTF-8 chr() which supports numeric entities
remove current tag from stack
wordwrap for utf8 encoded strings
Property Details
html block tags that allow inline & block children
protected array $allowMixedChildren
Résultat
array
wrap output, set to 0 to skip wrapping
protected int $bodyWidth
Résultat
integer
html tags to be dropped (contents will not be parsed!)
protected array $drop
Résultat
array
list of chars which have to be escaped in normal text
protected array $escapeInText
Résultat
array
html tags to be ignored (contents will be parsed)
protected array $ignore
Résultat
array
tags with elements which can be handled by markdown
protected array $isMarkdownable
Résultat
array
keep html tags which cannot be converted to markdown
protected bool $keepHTML
Résultat
boolean
name of last closed tag
protected string $lastClosedTag
Résultat
string
wether last processed node was a block tag or not
protected bool $lastWasBlockTag
Résultat
boolean
number of line breaks before next inline output
protected $lineBreaks
position where the link reference will be displayed
protected int $linkPosition
Résultat
integer
stack with tags which where not converted to html
protected array $notConverted
Résultat
array
skip conversion to markdown
protected bool $skipConversion
Résultat
boolean