public function ReadmehelpMarkdown::convertMultiEqualitySign in README Help 8
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.
Parameters
string $text: The string to be filtered.
Return value
string The HTML source with the heading.
1 call to ReadmehelpMarkdown::convertMultiEqualitySign()
- ReadmehelpMarkdown::process in src/
Plugin/ Filter/ ReadmehelpMarkdown.php - Performs the filter processing.
File
- src/
Plugin/ Filter/ ReadmehelpMarkdown.php, line 317
Class
- ReadmehelpMarkdown
- Provides a filter for markdown.
Namespace
Drupal\readmehelp\Plugin\FilterCode
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);
}