class ReadmehelpMarkdown in README Help 8
Provides a filter for markdown.
Plugin annotation
@Filter(
id = "readmehelp_markdown",
module = "readmehelp",
title = @Translation("Convert markdown into markup"),
description = @Translation("Converts basic markdown elements (like in README files) into HTML markup."),
type = Drupal\filter\Plugin\FilterInterface::TYPE_MARKUP_LANGUAGE,
settings = {
"quick_tips" = "",
},
weight = -100
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\filter\Plugin\FilterBase implements FilterInterface
- class \Drupal\readmehelp\Plugin\Filter\ReadmehelpMarkdown
- class \Drupal\filter\Plugin\FilterBase implements FilterInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ReadmehelpMarkdown
File
- src/
Plugin/ Filter/ ReadmehelpMarkdown.php, line 27
Namespace
Drupal\readmehelp\Plugin\FilterView source
class ReadmehelpMarkdown extends FilterBase {
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['quick_tips'] = [
'#type' => 'item',
'#title' => $this
->t('Quick tips'),
'#description' => $this
->t('You can use <a href=":readmehelp" name=":name">markdown syntax</a> like in README files to format and style the text. This syntax is a subset of the <a href=":github">Github Flavoured Markdown</a>. Note that this filter will always be kept at the top. After the filter it is recommended to place "Convert line breaks into HTML" and "Limit allowed HTML tags and correct faulty HTML" filters. The tags that should be allowed for proper working of the markdown filter are the following: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <h1 id> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <pre> <hr> <img src alt data-entity-type data-entity-uuid>. When using this filter with the CKEditor you need to press [Source] button on the editor while editing the markdown text. This is because markdown symbols are actually the source code similar to HTML tags. It is recommended to use this filter without any Rich Text Editor enabled on a text format.', [
':readmehelp' => Url::fromRoute('help.page', [
'name' => $this->provider,
])
->toString(),
':github' => 'https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet',
':name' => 'readmehelp-filter',
]),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function setConfiguration(array $configuration) {
if (isset($configuration['status'])) {
$this->status = (bool) $configuration['status'];
}
if (isset($configuration['weight'])) {
// Always run this filter as the very first.
$this->weight = -100;
}
if (isset($configuration['settings'])) {
$this->settings = (array) $configuration['settings'];
}
return $this;
}
/**
* {@inheritdoc}
*/
public function tips($long = FALSE) {
return $this
->t('You can use <a href=":readmehelp" name=":name">markdown syntax</a> like in README files to format and style the text. This syntax is a subset of the <a href=":github">Github Flavoured Markdown</a>.', [
':readmehelp' => Url::fromRoute('help.page', [
'name' => $this->provider,
])
->toString(),
':github' => 'https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet',
':name' => 'readmehelp-filter',
]);
}
/**
* {@inheritdoc}
*/
public function process($text, $langcode, $file_path = NULL) {
if (!empty($text)) {
$request = \Drupal::request();
$path = $request
->getPathInfo();
$host = str_replace($path, '', $request
->getSchemeAndHttpHost() . $request
->getRequestUri());
$path = $file_path ? trim($file_path, '/') : trim($path, '/');
$text = $text . "\n";
$text = preg_replace('/\\r\\n?/', '\\n', $text);
$text = preg_replace('/\\t/', ' ', $text);
$text = $this
->tokenizeEscapedSpecialChars($text);
$text = $this
->convertLeadingDashSpace($text);
$text = $this
->convertLeadingNumberDotSpace($text);
$text = $this
->convertLeadingGreaterThanSign($text);
$text = $this
->convertLeadingHash($text);
$text = $this
->convertLeadingMultiDashAsteriskUnderscore($text);
$text = $this
->convertMultiEqualitySign($text);
$text = $this
->convertMultiDashSign($text);
$text = $this
->convertDoubleAsterisk($text);
$text = $this
->convertSingleAsterisk($text);
$text = $this
->convertDoubleUnderscore($text);
$text = $this
->convertSingleUnderscore($text);
$text = $this
->convertMarkdownImage($text, $host, $path);
$text = $this
->convertMarkdownLink($text, $host);
$text = $this
->convertTripleBacktick($text);
$text = $this
->convertSingleBacktick($text);
$text = $this
->detokenizeSpecialChars($text);
}
return new FilterProcessResult($text);
}
/**
* Tokenizes escaped markdown special symbols.
*
* @param string $text
* The text string to be filtered.
*
* @return string
* The text with tokenized special symbols.
*/
public function tokenizeEscapedSpecialChars($text) {
return preg_replace_callback('/([\\\\])(.)/xs', function ($matches) {
$match = '';
if ($match = !empty($matches[2]) ? $matches[2] : '') {
if ($match == '*') {
$match = "@THEASTERISK@";
}
elseif ($match == '_') {
$match = "@THEUNDERSCORE@";
}
elseif ($match == '`') {
$match = "@THEBACKTICK@";
}
elseif ($match == '#') {
$match = "@THEHASH@";
}
elseif ($match == "-") {
$match = '@THEDASH@';
}
elseif ($match == '(') {
$match = "@THELEFTPAREN@";
}
elseif ($match == ")") {
$match = '@THERIGHTPAREN@';
}
elseif ($match == "[") {
$match = '@THELEFTBRACKET@';
}
elseif ($match == "]") {
$match = '@THERIGHTBRACKET@';
}
elseif ($match == " ") {
$match = '@THESPACE@';
}
elseif ($match == ">") {
$match = '@THEGREATERTHAN@';
}
else {
$match = $matches[0];
}
}
return $match;
}, $text);
}
/**
* Changes tokens for markdown special symbols.
*
* @param string $text
* The HTML string to be filtered.
*
* @return string
* The text with the symbols without special meaning.
*/
public function detokenizeSpecialChars($text) {
$pattern = '/(@THEASTERISK@)|(@THEUNDERSCORE@)|(@THEBACKTICK@)|(@THEHASH@)|(@THEDASH@)|(@THELEFTPAREN@)|(@THERIGHTPAREN@)|(@THELEFTBRACKET@)|(@THERIGHTBRACKET@)|(@THESPACE@)|(@THEGREATERTHAN@)/xs';
return preg_replace_callback($pattern, function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
if ($match == '@THEASTERISK@') {
$match = "*";
}
elseif ($match == '@THEUNDERSCORE@') {
$match = "_";
}
elseif ($match == '@THEBACKTICK@') {
$match = "`";
}
elseif ($match == '@THEHASH@') {
$match = "#";
}
elseif ($match == '@THEDASH@') {
$match = "-";
}
elseif ($match == '@THELEFTPAREN@') {
$match = "(";
}
elseif ($match == '@THERIGHTPAREN@') {
$match = ")";
}
elseif ($match == '@THELEFTBRACKET@') {
$match = "[";
}
elseif ($match == '@THERIGHTBRACKET@') {
$match = "]";
}
elseif ($match == '@THESPACE@') {
$match = " ";
}
elseif ($match == '@THEGREATERTHAN@') {
$match = ">";
}
}
return $match;
}, $text);
}
/**
* Wraps leading "- " text lines into unordered list tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with unordered list(s).
*/
public function convertLeadingDashSpace($text) {
return preg_replace_callback('/(?(DEFINE)(?<emptyline>(\\n\\n)))((\\n- )(.*?))(?&emptyline)/s', function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
$items = '';
foreach (explode('- ', $match) as $item) {
if ($item = trim($item)) {
$items .= "<li>{$item}</li>";
}
}
$match = $items ? "\n<ul class=\"ul\">{$items}</ul>\n" : $match;
}
return $match;
}, $text);
}
/**
* Wraps leading "NUMBER. " text lines into ordered list tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with ordered lists.
*/
public function convertLeadingNumberDotSpace($text) {
return preg_replace_callback('/(?(DEFINE)(?<emptyline>(\\n\\n)))(\\n\\d\\.\\ )(.*?)(?&emptyline)/s', function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
$match = preg_replace('/(^|\\n)\\d\\.\\ /s', '<LISTITEM>', $match);
$items = '';
foreach (explode('<LISTITEM>', $match) as $item) {
if ($item = trim($item)) {
$items .= "<li>{$item}</li>";
}
}
$match = $items ? "\n<ol class=\"ol\">{$items}</ol>\n" : $match;
}
return $match;
}, $text);
}
/**
* Wraps leading "> " or ">> " text lines into blockquote or cite tag.
*
* Additionally a leading sign turns into anchor link, so the blockquote can
* be used as a local or external link target. Multiple subsequent leading
* "> " or ">> " text lines can be used to wrap them into one tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with blockquote or cite blocks.
*/
public function convertLeadingGreaterThanSign($text) {
return preg_replace_callback('/(?(DEFINE)(?<emptyline>(\\n\\n)))(\\n>>? )(\\w.*?)(?&emptyline)/s', function ($matches) {
$match = '';
if ($match = !empty($matches[4]) ? preg_replace('/\\n>>? /', '', $matches[4]) : '') {
$id = trim(Html::getUniqueId(Unicode::truncate($match, 32, TRUE)), '-');
if (trim($matches[3]) == '>>') {
$tag = 'cite';
$sign = '>> ';
}
else {
$tag = 'blockquote';
$sign = '> ';
}
$match = "\n<{$tag}><a id=\"{$id}\" href=\"#{$id}\" class=\"anchor\">{$sign}</a>{$match}</{$tag}>\n";
}
return $match;
}, $text);
}
/**
* Wraps line followed with multi "=" sign line into h1 tag.
*
* Can be used just once at the very beginning of a text. Additionally "#"
* sign turned into anchor link, so the heading can be used as a local or
* externallink target.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with the heading.
*/
public function convertMultiEqualitySign($text) {
return preg_replace_callback('/^(\\w.*?)\\n=+\\n/', function ($matches) {
if ($match = !empty($matches[1]) ? rtrim($matches[1]) : '') {
$id = trim(Html::getUniqueId($match), '-');
$match = "<h1><a id=\"{$id}\" href=\"#{$id}\" class=\"anchor\"># </a>{$match}</h1>";
}
return $match;
}, $text);
}
/**
* Wraps line followed with multi "-" sign line into h2 tag.
*
* Additionally "#" sign turned into anchor link, so the heading can be used
* as a local or external link target.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with the heading.
*/
public function convertMultiDashSign($text) {
return preg_replace_callback('/\\n(\\w.*?)\\n\\-+\\n/', function ($matches) {
if ($match = !empty($matches[1]) ? rtrim($matches[1]) : '') {
$id = trim(Html::getUniqueId($match), '-');
$match = "<h2 class=\"h-2\"><a id=\"{$id}\" href=\"#{$id}\" class=\"anchor\"># </a>{$match}</h2>";
}
return $match;
}, $text);
}
/**
* Wraps lines preceded with up to 6 "#" + " " text lines into h1-6 tag.
*
* The single "# " can be used just once at the very beginning of a text.
* Other hash signs + space sets can be used multiple times in a text.
* Additionally, "#" sign turns into anchor link, so the heading can be used
* as a local or external link target.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with headings.
*/
public function convertLeadingHash($text) {
foreach (range(1, 6) as $i) {
$hash = str_pad('#', $i, "#");
$j = $i > 1 ? '\\n' . $hash : '^' . $hash;
$text = preg_replace_callback('/' . $j . '(\\s+\\w.*?)\\n/', function ($matches) use ($i) {
if ($match = !empty($matches[1]) ? rtrim($matches[1]) : '') {
$id = trim(Html::getUniqueId($match), '-');
$match = "<h{$i} class=\"h-{$i}\"><a id=\"{$id}\" href=\"#{$id}\" class=\"anchor\">#</a>{$match}</h{$i}>";
}
return $match;
}, $text);
}
return $text;
}
/**
* Replaces "*", "-" and "_" sign sequences by a ruler tag.
*
* At least three signs should placed on a line wrapped into two empty lines.
* The "___" turns into a slim ruler tag, the "***" turns into middle one
* and "---" into fat ruler tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with the rulers.
*/
public function convertLeadingMultiDashAsteriskUnderscore($text) {
$pattern = '/(\\n\\n)(\\-\\-\\-+\\n+)|(\\*\\*\\*+\\n+)|(\\_\\_\\_+\\n+)(\\n)/xs';
return preg_replace_callback($pattern, function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
if (strstr($match, '___')) {
$class = 'underscore';
}
elseif (strstr($match, '***')) {
$class = 'asterisk';
}
else {
$class = 'dash';
}
$match = "\n\n<hr class=\"hr-{$class}\">\n\n";
}
return $match;
}, $text);
}
/**
* Replaces pairs of "*" signs by the em tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with emphasized text.
*/
public function convertSingleAsterisk($text) {
return preg_replace_callback('/(\\*[^*]*?\\*)/', function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
$match = "<em>" . str_replace('*', '', $match) . "</em>";
}
return $match;
}, $text);
}
/**
* Replaces pairs of "**" signs by the strong tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with emphasized text.
*/
public function convertDoubleAsterisk($text) {
return preg_replace_callback('/(\\*\\*[^*]*?\\*\\*)/', function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
$match = "<strong>" . str_replace('*', '', $match) . "</strong>";
}
return $match;
}, $text);
}
/**
* Replaces pairs of "_" signs by the em tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with emphasized text.
*/
public function convertSingleUnderscore($text) {
return preg_replace_callback('/(\\s)(_[^_]*?_)/', function ($matches) {
$match = '';
if ($match = !empty($matches[2]) ? $matches[2] : '') {
$char = isset($matches[3]) ? $matches[3] : '';
$match = "{$matches[1]}<em>" . str_replace('_', '', $match) . "</em>{$char}";
}
return $match;
}, $text);
}
/**
* Replaces pairs of "__" signs by the strong tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with emphasized text.
*/
public function convertDoubleUnderscore($text) {
return preg_replace_callback('/(\\s)(__[^_]*?__)/', function ($matches) {
$match = '';
if ($match = !empty($matches[2]) ? $matches[2] : '') {
$char = isset($matches[3]) ? $matches[3] : '';
$match = "{$matches[1]}<strong>" . str_replace('_', '', $match) . "</strong>{$char}";
}
return $match;
}, $text);
}
/**
* Replaces pairs of single "`" signs by the code tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with text wrapped into code tag.
*/
public function convertSingleBacktick($text) {
return preg_replace_callback('/`[^`]*?[^`]`/', function ($matches) {
$match = '';
if ($match = !empty($matches[0]) ? $matches[0] : '') {
$match = "<code class=\"code--singleline\">" . str_replace('`', '', $match) . "</code>";
}
return $match;
}, $text);
}
/**
* Replaces pairs of triple "```" signs by the code tag.
*
* @param string $text
* The string to be filtered.
*
* @return string
* The HTML source with text wrapped into code tag which is wrapped into
* the pre tag.
*/
public function convertTripleBacktick($text) {
return preg_replace_callback('/(```\\w*)[^`].*?[^`](```)/xs', function ($matches) {
$match = '';
if ($match = !empty($matches[2]) ? $matches[0] : '') {
$match = "<pre><code class=\"code--multiline\">" . str_replace([
$matches[1],
$matches[2],
], '', $match) . "</code></pre>";
}
return $match;
}, $text);
}
/**
* Converts markdown syntax image into HTML image.
*
* The markdown image should look like this:
* @code
* ## A relative to a module directory path. The "Title" is optional.
* ![Alt](images/my-image.png "Title")
*
* ## An absolute path
* ![Alt](
* https://example.com/modules/contrib/my_module/images/my-image.png "Title")
* @code
*
* Note that in the case of relative path the internal path to a module's
* directory is taken from the current request. So, if the request looks like
* https://example.com/modules/contrib/my_module/images then the markdown
* image should be constructed like this:
* @code
* ![Alt](my-image.png "Title")
* @code
*
* @param string $text
* The string to be filtered.
* @param string $host
* (optional) The base URL of a site, like: http(s)://example.com.
* @param string $path
* (optional) The path part of the URL, like: modules/contrib/my_module.
*
* @return string
* The HTML source with image tags.
*/
public function convertMarkdownImage($text, $host, $path) {
$parts = explode('?', $path);
$path = isset($parts[0]) ? $parts[0] : 'NOT-A-PATH';
$pattern = '/(!\\[((?>[^\\[\\]]+|\\[\\])*)\\]\\s?\\([ \\n]*(?:<(\\S*)>|((?>[^()\\s]+|\\((?>\\)))*))[ \\n]*(([\'"])(.*?)\\6[ \\n]*)?\\))/xs';
return preg_replace_callback($pattern, function ($matches) use ($host, $path) {
$alt = $matches[2];
$url = $matches[3] == '' ? $matches[4] : $matches[3];
$title = empty($matches[7]) ? $alt : $matches[7];
$src = "{$host}/{$path}/{$url}";
if (preg_match('/^http/', $url)) {
$src = $url;
}
return "<img src=\"{$src}\" alt=\"{$alt}\" title=\"{$title}\" class=\"markdown-image\" />";
}, $text);
}
/**
* Converts markdown syntax anchor into HTML anchor.
*
* The markdown anchor should look like this:
* @code
* > The Drupal site's internal page path. The "Title" is optional. The url is
* taken from the link's textual part. The # part of the url is to render
* README markdown file and have the same link to look similar both on the
* Drupal site and extenal vcs systems like Github. The difference is that on
* Github it works just as a dummy link but on the Drupal site it leads to a
* really existing page.
* [admin/reports/dblog](#admin-reports-dblog "Title")
*
* ## An absolute path.
* [Recent log messages](https://example.com/admin/reports/dblog "Title")
* @code
*
* @param string $text
* The string to be filtered.
* @param string $host
* (optional) The base URL of a site, like: http(s)://example.com.
*
* @return string
* The HTML source with anchor tags.
*/
public function convertMarkdownLink($text, $host) {
$pattern = '/(\\[((?>[^\\[\\]]+|\\[\\])*)\\]\\([ \\n]*(?:<(.+?)>|((?>[^()\\s]+|\\((?>\\)))*))[ \\n]*(([\'"])(.*?)\\6[ \\n]*)?\\))/xs';
return preg_replace_callback($pattern, function ($matches) use ($host) {
$text = $matches[2];
$parts = explode('?', $text);
$text = isset($parts[0]) ? $parts[0] : 'NOT-A-TEXT';
$url = $matches[3] == '' ? $matches[4] : $matches[3];
$parts = explode('?', $url);
$url = isset($parts[0]) ? $parts[0] : 'NOT-A-URL';
$title = empty($matches[7]) ? $text : $matches[7];
if (preg_match('{^.*[#].*}', $text)) {
$parts = explode('?', $text);
$url = "{$host}/{$parts[0]}";
$text = $title;
}
elseif (!preg_match('/^http/', $url)) {
$url = "{$host}/{$text}";
}
return "<a href=\"{$url}\" title=\"{$title}\" class=\"markdown-link\">{$text}</a>";
}, $text);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
FilterBase:: |
public | property | The name of the provider that owns this filter. | |
FilterBase:: |
public | property | An associative array containing the configured settings of this filter. | |
FilterBase:: |
public | property | A Boolean indicating whether this filter is enabled. | |
FilterBase:: |
public | property | The weight of this filter compared to others in a filter collection. | |
FilterBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
1 |
FilterBase:: |
public | function |
Gets default configuration for this plugin. Overrides ConfigurableInterface:: |
|
FilterBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
FilterBase:: |
public | function |
Returns the administrative description for this filter plugin. Overrides FilterInterface:: |
|
FilterBase:: |
public | function |
Returns HTML allowed by this filter's configuration. Overrides FilterInterface:: |
4 |
FilterBase:: |
public | function |
Returns the administrative label for this filter plugin. Overrides FilterInterface:: |
|
FilterBase:: |
public | function |
Returns the processing type of this filter plugin. Overrides FilterInterface:: |
|
FilterBase:: |
public | function |
Prepares the text for processing. Overrides FilterInterface:: |
|
FilterBase:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |
4 |
FilterInterface:: |
constant | HTML tag and attribute restricting filters to prevent XSS attacks. | ||
FilterInterface:: |
constant | Non-HTML markup language filters that generate HTML. | ||
FilterInterface:: |
constant | Irreversible transformation filters. | ||
FilterInterface:: |
constant | Reversible transformation filters. | ||
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
ReadmehelpMarkdown:: |
public | function | Replaces pairs of "**" signs by the strong tag. | |
ReadmehelpMarkdown:: |
public | function | Replaces pairs of "__" signs by the strong tag. | |
ReadmehelpMarkdown:: |
public | function | Wraps leading "- " text lines into unordered list tag. | |
ReadmehelpMarkdown:: |
public | function | Wraps leading "> " or ">> " text lines into blockquote or cite tag. | |
ReadmehelpMarkdown:: |
public | function | Wraps lines preceded with up to 6 "#" + " " text lines into h1-6 tag. | |
ReadmehelpMarkdown:: |
public | function | Replaces "*", "-" and "_" sign sequences by a ruler tag. | |
ReadmehelpMarkdown:: |
public | function | Wraps leading "NUMBER. " text lines into ordered list tag. | |
ReadmehelpMarkdown:: |
public | function | Converts markdown syntax image into HTML image. | |
ReadmehelpMarkdown:: |
public | function | Converts markdown syntax anchor into HTML anchor. | |
ReadmehelpMarkdown:: |
public | function | Wraps line followed with multi "-" sign line into h2 tag. | |
ReadmehelpMarkdown:: |
public | function | Wraps line followed with multi "=" sign line into h1 tag. | |
ReadmehelpMarkdown:: |
public | function | Replaces pairs of "*" signs by the em tag. | |
ReadmehelpMarkdown:: |
public | function | Replaces pairs of single "`" signs by the code tag. | |
ReadmehelpMarkdown:: |
public | function | Replaces pairs of "_" signs by the em tag. | |
ReadmehelpMarkdown:: |
public | function | Replaces pairs of triple "```" signs by the code tag. | |
ReadmehelpMarkdown:: |
public | function | Changes tokens for markdown special symbols. | |
ReadmehelpMarkdown:: |
public | function |
Performs the filter processing. Overrides FilterInterface:: |
|
ReadmehelpMarkdown:: |
public | function |
Sets the configuration for this plugin instance. Overrides FilterBase:: |
|
ReadmehelpMarkdown:: |
public | function |
Generates a filter's settings form. Overrides FilterBase:: |
|
ReadmehelpMarkdown:: |
public | function |
Generates a filter's tip. Overrides FilterBase:: |
|
ReadmehelpMarkdown:: |
public | function | Tokenizes escaped markdown special symbols. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |