RichTextToMarkdownConverter
extends BaseRichTextConverter
in package
This parser can be used to convert HumHub richtext to plain markdown by removing special richtext markdown syntax.
Note: The output of this converter will not be encoded, so do not directly embed the output to a HTML view without
encoding. When using this as export format, the frontend responsible for rendering the markdown needs to make sure
to purify the result and ideally deactivate direct html parsing e.g.: require('markdown-it')({html:false, ...})
Tags
Table of Contents
Constants
- EVENT_AFTER_PARSE = 'afterParse'
- EVENT_BEFORE_PARSE = 'beforeParse'
- MAX_CACHE_ENTRIES = 200
- Maximum entries in the cache
- OPTION_CACHE_KEY = 'cacheKey'
- Cache key can be used to cache parser results
- OPTION_EXCLUDE = 'exclude'
- Option key for excluding blocks or extensions.
- OPTION_IMAGE_AS_LINK = 'imageAsLink'
- Option key used for rendering images as links.
- OPTION_IMAGE_AS_URL = 'imageAsText'
- Option key used for rendering images as url links.
- OPTION_LINK_AS_TEXT = 'linkAsText'
- Option key used for rendering links as plain text.
- OPTION_LINK_TARGET = 'linkTarget'
- Option key for overwriting default link target _blank.
- OPTION_PREV_LINK_TARGET = 'prevLinkTarget'
- Option key for preventing link target attribute.
- BOLD_WRAPPER = '**'
- Wrapper mark for bold markdown text
- EMPHASIZE_WRAPPER = '_'
- Wrapper mark for emphasized markdown text
- IMAGE_SUFFIX = '!'
- Suffix used for markdown images
- INLINE_CODE_WRAPPER = '`'
- Wrapper mark for inline code markdown
- STRIKE_WRAPPER = '~~'
- Wrapper mark for strikethrough markdown text
Properties
- $cache : array<string|int, mixed>
- $enableNewlines : bool
- $format : string
- $html5 : mixed
- $keepListStartNumber : bool
- $maximumNestingLevel : int
- $options : array<string|int, mixed>
- $context : array<string|int, mixed>
- $escapeBackslashBreak : bool
- $escapeCharacters : array<string|int, mixed>
- $extensions : array<string|int, RichTextExtension>
- $identifyQuote : bool
- $identifyTable : bool
- $inlineHtmlElements : array<string|int, mixed>
- $linkExtensions : array<string|int, RichTextLinkExtension>
- $references : array<string|int, mixed>
- $selfClosingHtmlElements : array<string|int, mixed>
- $_blockTypes : mixed
- $_depth : mixed
- $_inlineMarkers : array<string|int, mixed>
Methods
- __construct() : mixed
- BaseRichTextParser constructor.
- addExtension() : mixed
- Can be used to add additional richtext extensions
- buildCacheKeyForContent() : string
- Builds a cache key for a given content. When using this function with specific parser options a $prefix should be provided in order to not interfere with other parser results.
- buildCacheKeyForRecord() : string
- Builds a cache key for a given record. When using this function with specific parser options a $prefix should be provided in order to not interfere with other parser results.
- flushCache() : mixed
- This function can be used to flush existing parser result caches of this converter class
- getOption() : mixed
- parse() : string
- Parses the given text considering the full language.
- parseParagraph() : string
- Parses a paragraph without block elements (block elements are ignored).
- process() : string
- Converts markdown into HTML.
- blockTypes() : array<string|int, mixed>
- br2nl() : string
- Helper function to translate br tags to new lines
- cleanup() : mixed
- This method will be called after `parse()` and `parseParagraph()`.
- composeTable() : string
- This method composes a table from parsed body and head HTML.
- consumeCode() : mixed
- Consume lines for a code block element
- consumeFencedCode() : mixed
- Consume lines for a fenced code block
- consumeHeadline() : mixed
- Consume lines for a headline
- consumeHr() : mixed
- Consume a horizontal rule
- consumeHtml() : mixed
- Consume lines for an HTML block
- consumeOl() : mixed
- consumeParagraph() : array<string|int, mixed>
- Consume lines for a paragraph
- consumeQuote() : mixed
- Consume lines for a blockquote element
- consumeReference() : mixed
- Consume link references
- consumeTable() : mixed
- Consume lines for a table
- consumeUl() : mixed
- Consume lines for an unordered list
- detectLineType() : mixed
- identifyCode() : mixed
- identify a line as the beginning of a code block.
- identifyFencedCode() : mixed
- identify a line as the beginning of a fenced code block.
- identifyHeadline() : mixed
- identify a line as a headline
- identifyHr() : mixed
- identify a line as a horizontal rule.
- identifyHtml() : mixed
- identify a line as the beginning of a HTML block.
- identifyOl() : mixed
- identify a line as the beginning of an ordered list.
- identifyQuote() : false
- Deactivates quote parsing in caste [[identifyQuote]] flag is false (default).
- identifyReference() : mixed
- identifyTable() : bool
- Deactivates table parsing in caste [[identifyTable]] flag is false (default).
- identifyUl() : mixed
- identify a line as the beginning of an unordered list.
- inlineMarkers() : array<string|int, mixed>
- Returns a map of inline markers to the corresponding parser methods.
- lookupReference() : mixed
- onAfterParse() : mixed|string
- This function is called after the parser starts parsing the given `$text`.
- onBeforeParse() : mixed|string
- This function is called right before the parser starts parsing the given `$text`.
- parseBlock() : array<string|int, mixed>
- Parses the block at current line by identifying the block type and parsing the content
- parseBlocks() : mixed
- parseEmphStrong() : mixed
- Parses emphasized and strong elements.
- parseEntity() : mixed
- html entity mark parser is disabled by removing marker in php doc
- parseEscape() : mixed
- Parses escaped special characters.
- parseGt() : mixed
- `>` mark parser is disabled by removing marker in php doc
- parseImage() : mixed
- Parses an image indicated by `
- parseLt() : mixed
- `<` mark parser is disabled by removing marker in php doc
- parseStrike() : mixed
- Parses the strikethrough feature.
- parseTd() : mixed
- Deactivated by removing marker
- parseUrl() : mixed
- Parses urls and adds auto linking feature.
- prepare() : mixed
- This method will be called before `parse()` and `parseParagraph()`.
- prepareMarkers() : mixed
- Prepare markers that are used in the text to parse
- renderAbsy() : mixed
- renderAutoUrl() : string
- renderCode() : string
- renderEmail() : string
- Returns a plain markdown representation of an email
- renderEmph() : string
- renderHeadline() : string
- renderHr() : string
- renderHtml() : string
- renderImage() : mixed
- renderInlineCode() : string
- renderInlineHtml() : string
- renderLink() : string
- Renders the given link block to plain text <text>(<url>).
- renderLinkExtension() : string
- renderLinkOrImage() : mixed
- renderList() : string
- Returns a plain text representation of a list block
- renderParagraph() : string
- Returns a plain text representation of a text paragraph
- renderPlainImage() : string
- renderPlainLink() : string
- renderQuote() : string
- renderStrike() : string
- renderStrong() : string
- renderTable() : mixed
- render a table block
- renderText() : string
- This function renders plain text sections in the markdown text.
- renderUrl() : string
- replaceEscape() : string
- Remove backslash from escaped characters
- consumeList() : mixed
- generateHtmlAttributes() : string
- Return html attributes string from [attrName => attrValue] list
- getExcludes() : mixed
Constants
EVENT_AFTER_PARSE
public
mixed
EVENT_AFTER_PARSE
= 'afterParse'
Tags
EVENT_BEFORE_PARSE
public
mixed
EVENT_BEFORE_PARSE
= 'beforeParse'
Tags
MAX_CACHE_ENTRIES
Maximum entries in the cache
public
mixed
MAX_CACHE_ENTRIES
= 200
OPTION_CACHE_KEY
Cache key can be used to cache parser results
public
mixed
OPTION_CACHE_KEY
= 'cacheKey'
OPTION_EXCLUDE
Option key for excluding blocks or extensions.
public
mixed
OPTION_EXCLUDE
= 'exclude'
Note, this option affects the cached result.
OPTION_IMAGE_AS_LINK
Option key used for rendering images as links.
public
mixed
OPTION_IMAGE_AS_LINK
= 'imageAsLink'
Note, this option affects the cached result.
OPTION_IMAGE_AS_URL
Option key used for rendering images as url links.
public
mixed
OPTION_IMAGE_AS_URL
= 'imageAsText'
Note, this option affects the cached result.
OPTION_LINK_AS_TEXT
Option key used for rendering links as plain text.
public
mixed
OPTION_LINK_AS_TEXT
= 'linkAsText'
Note, this option affects the cached result.
OPTION_LINK_TARGET
Option key for overwriting default link target _blank.
public
mixed
OPTION_LINK_TARGET
= 'linkTarget'
Note, this option affects the cached result.
OPTION_PREV_LINK_TARGET
Option key for preventing link target attribute.
public
mixed
OPTION_PREV_LINK_TARGET
= 'prevLinkTarget'
Note, this option affects the cached result.
BOLD_WRAPPER
Wrapper mark for bold markdown text
protected
mixed
BOLD_WRAPPER
= '**'
EMPHASIZE_WRAPPER
Wrapper mark for emphasized markdown text
protected
mixed
EMPHASIZE_WRAPPER
= '_'
IMAGE_SUFFIX
Suffix used for markdown images
protected
mixed
IMAGE_SUFFIX
= '!'
INLINE_CODE_WRAPPER
Wrapper mark for inline code markdown
protected
mixed
INLINE_CODE_WRAPPER
= '`'
STRIKE_WRAPPER
Wrapper mark for strikethrough markdown text
protected
mixed
STRIKE_WRAPPER
= '~~'
Properties
$cache
public
static array<string|int, mixed>
$cache
= []
$enableNewlines
public
bool
$enableNewlines
= false
whether to interpret newlines as <br />
-tags.
This feature is useful for comments where newlines are often meant to be real new lines.
$format
public
string
$format
= \humhub\modules\content\widgets\richtext\ProsemirrorRichText::FORMAT_MARKDOWN
Tags
$html5
public
mixed
$html5
= true
Tags
$keepListStartNumber
public
bool
$keepListStartNumber
= false
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(
- ) starts with 1.
$maximumNestingLevel
public
int
$maximumNestingLevel
= 32
the maximum nesting level for language elements.
$options
public
array<string|int, mixed>
$options
= []
$context
protected
array<string|int, mixed>
$context
= []
the current context the parser is in. TODO remove in favor of absy
$escapeBackslashBreak
protected
bool
$escapeBackslashBreak
= false
$escapeCharacters
protected
array<string|int, mixed>
$escapeCharacters
= [
// from Markdown
'\\',
// backslash
'`',
// backtick
'*',
// asterisk
'_',
// underscore
'{',
'}',
// curly braces
'[',
']',
// square brackets
'(',
')',
// parentheses
'#',
// hash mark
'+',
// plus sign
'-',
// minus sign (hyphen)
'.',
// dot
'!',
// exclamation mark
'<',
'>',
// added by GithubMarkdown
':',
// colon
'|',
]
these are "escapeable" characters. When using one of these prefixed with a backslash, the character will be outputted without the backslash and is not interpreted as markdown.
Tags
$extensions
protected
array<string|int, RichTextExtension>
$extensions
= []
$identifyQuote
protected
bool
$identifyQuote
= false
whether or not quotes should be parsed, in case subclasses want to overwrite renderQuote()
, this flag
needs to be set to true
$identifyTable
protected
bool
$identifyTable
= false
whether or not tables should be parsed, in case subclasses want to overwrite renderTable()
, this flag
needs to be set to true
$inlineHtmlElements
protected
array<string|int, mixed>
$inlineHtmlElements
= ['a', 'abbr', 'acronym', 'b', 'basefont', 'bdo', 'big', 'br', 'button', 'blink', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'img', 'ins', 'input', 'iframe', 'kbd', 'label', 'listing', 'map', 'mark', 'nobr', 'object', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'select', 'small', 'spacer', 'span', 'strong', 'sub', 'sup', 'tt', 'var', 'u', 'wbr', 'time']
HTML elements considered as inline elements.
Tags
$linkExtensions
protected
array<string|int, RichTextLinkExtension>
$linkExtensions
= []
$references
protected
array<string|int, mixed>
$references
= []
a list of defined references in this document.
$selfClosingHtmlElements
protected
array<string|int, mixed>
$selfClosingHtmlElements
= ['br', 'hr', 'img', 'input', 'nobr']
HTML elements known to be self-closing.
$_blockTypes
private
mixed
$_blockTypes
$_depth
private
mixed
$_depth
= 0
$_inlineMarkers
private
array<string|int, mixed>
$_inlineMarkers
= []
the set of inline markers to use in different contexts.
Methods
__construct()
BaseRichTextParser constructor.
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
addExtension()
Can be used to add additional richtext extensions
public
addExtension(RichTextExtension $extension) : mixed
Parameters
- $extension : RichTextExtension
buildCacheKeyForContent()
Builds a cache key for a given content. When using this function with specific parser options a $prefix should be provided in order to not interfere with other parser results.
public
static buildCacheKeyForContent(ContentOwner $content[, string|null $prefix = null ]) : string
Options only affecting the result within the onAfterParse
will not alter the cached result and therefore can
be used without prefix.
Parameters
- $content : ContentOwner
- $prefix : string|null = null
-
a prefix used for use-cases with specific parser options to not interfere with other results
Return values
stringbuildCacheKeyForRecord()
Builds a cache key for a given record. When using this function with specific parser options a $prefix should be provided in order to not interfere with other parser results.
public
static buildCacheKeyForRecord(ActiveRecord $record[, string|null $prefix = null ]) : string
Options only affecting the result within the onAfterParse
will not alter the cached result and therefore can
be used without prefix.
Parameters
- $record : ActiveRecord
- $prefix : string|null = null
-
a prefix used for use-cases with specific parser options to not interfere with other results
Return values
stringflushCache()
This function can be used to flush existing parser result caches of this converter class
public
static flushCache() : mixed
getOption()
public
getOption(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
parse()
Parses the given text considering the full language.
public
parse(mixed $text) : string
Parameters
- $text : mixed
-
the text to parse
Tags
Return values
string —parsed markup
parseParagraph()
Parses a paragraph without block elements (block elements are ignored).
public
parseParagraph(string $text) : string
Parameters
- $text : string
-
the text to parse
Return values
string —parsed markup
process()
Converts markdown into HTML.
public
static process(string $text[, mixed $options = [] ]) : string
Parameters
- $text : string
-
the richtext to parse
- $options : mixed = []
Return values
string —the parser result
blockTypes()
protected
blockTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —a list of block element types available.
br2nl()
Helper function to translate br tags to new lines
protected
br2nl(mixed $text) : string
Parameters
- $text : mixed
Return values
stringcleanup()
This method will be called after `parse()` and `parseParagraph()`.
protected
cleanup() : mixed
You can override it to do cleanup.
composeTable()
This method composes a table from parsed body and head HTML.
protected
composeTable(string $head, string $body) : string
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"
Parameters
- $head : string
-
table head HTML.
- $body : string
-
table body HTML.
Tags
Return values
string —the complete table HTML.
consumeCode()
Consume lines for a code block element
protected
consumeCode(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeFencedCode()
Consume lines for a fenced code block
protected
consumeFencedCode(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeHeadline()
Consume lines for a headline
protected
consumeHeadline(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeHr()
Consume a horizontal rule
protected
consumeHr(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeHtml()
Consume lines for an HTML block
protected
consumeHtml(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeOl()
protected
consumeOl(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
Tags
consumeParagraph()
Consume lines for a paragraph
protected
consumeParagraph(mixed $lines, mixed $current) : array<string|int, mixed>
Allow headlines, lists and code to break paragraphs
Parameters
- $lines : mixed
- $current : mixed
Return values
array<string|int, mixed>consumeQuote()
Consume lines for a blockquote element
protected
consumeQuote(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeReference()
Consume link references
protected
consumeReference(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeTable()
Consume lines for a table
protected
consumeTable(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
consumeUl()
Consume lines for an unordered list
protected
consumeUl(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
detectLineType()
protected
abstract detectLineType(mixed $lines, mixed $current) : mixed
Parameters
- $lines : mixed
- $current : mixed
identifyCode()
identify a line as the beginning of a code block.
protected
identifyCode(mixed $line) : mixed
Parameters
- $line : mixed
identifyFencedCode()
identify a line as the beginning of a fenced code block.
protected
identifyFencedCode(mixed $line) : mixed
Parameters
- $line : mixed
identifyHeadline()
identify a line as a headline
protected
identifyHeadline(mixed $line, mixed $lines, mixed $current) : mixed
Parameters
- $line : mixed
- $lines : mixed
- $current : mixed
identifyHr()
identify a line as a horizontal rule.
protected
identifyHr(mixed $line) : mixed
Parameters
- $line : mixed
identifyHtml()
identify a line as the beginning of a HTML block.
protected
identifyHtml(mixed $line, mixed $lines, mixed $current) : mixed
Parameters
- $line : mixed
- $lines : mixed
- $current : mixed
identifyOl()
identify a line as the beginning of an ordered list.
protected
identifyOl(mixed $line) : mixed
Parameters
- $line : mixed
identifyQuote()
Deactivates quote parsing in caste [[identifyQuote]] flag is false (default).
protected
identifyQuote(mixed $line) : false
Parameters
- $line : mixed
Return values
falseidentifyReference()
protected
identifyReference(mixed $line) : mixed
Parameters
- $line : mixed
identifyTable()
Deactivates table parsing in caste [[identifyTable]] flag is false (default).
protected
identifyTable(mixed $line, mixed $lines, mixed $current) : bool
Parameters
- $line : mixed
- $lines : mixed
- $current : mixed
Return values
boolidentifyUl()
identify a line as the beginning of an unordered list.
protected
identifyUl(mixed $line) : mixed
Parameters
- $line : mixed
inlineMarkers()
Returns a map of inline markers to the corresponding parser methods.
protected
inlineMarkers() : array<string|int, mixed>
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 values
array<string|int, mixed> —a map of markers to parser methods
lookupReference()
protected
lookupReference(mixed $key) : mixed
Parameters
- $key : mixed
onAfterParse()
This function is called after the parser starts parsing the given `$text`.
protected
onAfterParse(mixed $text) : mixed|string
Parameters
- $text : mixed
Tags
Return values
mixed|stringonBeforeParse()
This function is called right before the parser starts parsing the given `$text`.
protected
onBeforeParse(mixed $text) : mixed|string
Sub classes may use this function to prepare the richtext prior to parsing.
When overwriting, sub classes need to call:
protected function onBeforeParse($text)
{
$text = parent::onBeforeParse($text);
// do some modification to text
return $text;
}
Parameters
- $text : mixed
Return values
mixed|stringparseBlock()
Parses the block at current line by identifying the block type and parsing the content
protected
parseBlock(mixed $lines, mixed $current) : array<string|int, mixed>
Parameters
- $lines : mixed
- $current : mixed
Return values
array<string|int, mixed> —Array of two elements, the first element contains the block, the second contains the next line index to be parsed.
parseBlocks()
protected
abstract parseBlocks(mixed $lines) : mixed
Parameters
- $lines : mixed
parseEmphStrong()
Parses emphasized and strong elements.
protected
parseEmphStrong(mixed $text) : mixed
Parameters
- $text : mixed
Tags
parseEntity()
html entity mark parser is disabled by removing marker in php doc
protected
parseEntity(mixed $text) : mixed
Parameters
- $text : mixed
parseEscape()
Parses escaped special characters.
protected
parseEscape(mixed $text) : mixed
Parameters
- $text : mixed
Tags
parseGt()
`>` mark parser is disabled by removing marker in php doc
protected
parseGt(mixed $text) : mixed
Parameters
- $text : mixed
parseImage()
Parses an image indicated by `
protected
parseLinkOrImage(mixed $markdown) : array<string|int, mixed>|bool
Parameters
- $markdown : mixed
Return values
array<string|int, mixed>|boolparseLt()
`<` mark parser is disabled by removing marker in php doc
protected
parseLt(mixed $text) : mixed
Parameters
- $text : mixed
parseStrike()
Parses the strikethrough feature.
protected
parseStrike(mixed $markdown) : mixed
Parameters
- $markdown : mixed
Tags
parseTd()
Deactivated by removing marker
protected
parseTd(mixed $markdown) : mixed
Parameters
- $markdown : mixed
parseUrl()
Parses urls and adds auto linking feature.
protected
parseUrl(mixed $markdown) : mixed
Parameters
- $markdown : mixed
Tags
prepare()
This method will be called before `parse()` and `parseParagraph()`.
protected
prepare() : mixed
Tags
prepareMarkers()
Prepare markers that are used in the text to parse
protected
prepareMarkers(string $text) : mixed
Add all markers that are present in markdown. Check is done to avoid iterations in parseInline(), good for huge markdown files
Parameters
- $text : string
renderAbsy()
protected
renderAbsy(mixed $blocks) : mixed
Parameters
- $blocks : mixed
renderAutoUrl()
protected
renderAutoUrl(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderCode()
protected
renderCode(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderEmail()
Returns a plain markdown representation of an email
protected
renderEmail(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderEmph()
protected
renderEmph(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderHeadline()
protected
renderHeadline(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderHr()
protected
renderHr(mixed $line) : string
Parameters
- $line : mixed
Return values
stringrenderHtml()
protected
renderHtml(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderImage()
protected
renderImage(mixed $block) : mixed
Parameters
- $block : mixed
renderInlineCode()
protected
renderInlineCode(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderInlineHtml()
protected
renderInlineHtml(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderLink()
Renders the given link block to plain text <text>(<url>).
protected
renderLink(mixed $block) : string
This function respects richtext link extensions and tries to determine a link extension by extension url. A
e.g. The plaintext conversion of a mention extension [Some Name](metion:guid)
will be handled by the
MentioningExtension
class.
Parameters
- $block : mixed
Return values
stringrenderLinkExtension()
protected
renderLinkExtension(RichTextLinkExtension $ext, LinkParserBlock $linkBlock) : string
Parameters
- $ext : RichTextLinkExtension
- $linkBlock : LinkParserBlock
Return values
stringrenderLinkOrImage()
protected
renderLinkOrImage(LinkParserBlock $linkBlock) : mixed
Parameters
- $linkBlock : LinkParserBlock
renderList()
Returns a plain text representation of a list block
protected
renderList(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderParagraph()
Returns a plain text representation of a text paragraph
protected
renderParagraph(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderPlainImage()
protected
renderPlainImage(LinkParserBlock $linkBlock) : string
Parameters
- $linkBlock : LinkParserBlock
Tags
Return values
stringrenderPlainLink()
protected
renderPlainLink(LinkParserBlock $linkBlock) : string
Parameters
- $linkBlock : LinkParserBlock
Tags
Return values
stringrenderQuote()
protected
renderQuote(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderStrike()
protected
renderStrike(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderStrong()
protected
renderStrong(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderTable()
render a table block
protected
renderTable(mixed $block) : mixed
Parameters
- $block : mixed
renderText()
This function renders plain text sections in the markdown text.
protected
renderText(mixed $block) : string
Parameters
- $block : mixed
Return values
stringrenderUrl()
protected
renderUrl(mixed $block) : string
Parameters
- $block : mixed
Return values
stringreplaceEscape()
Remove backslash from escaped characters
protected
replaceEscape(mixed $text) : string
Parameters
- $text : mixed
Return values
stringconsumeList()
private
consumeList(mixed $lines, mixed $current, mixed $block, mixed $type) : mixed
Parameters
- $lines : mixed
- $current : mixed
- $block : mixed
- $type : mixed
generateHtmlAttributes()
Return html attributes string from [attrName => attrValue] list
private
generateHtmlAttributes(array<string|int, mixed> $attributes) : string
Parameters
- $attributes : array<string|int, mixed>
-
the attribute name-value pairs.
Return values
stringgetExcludes()
private
getExcludes() : mixed