public function ReadmehelpMarkdown::convertDoubleUnderscore in README Help 8
Replaces pairs of "__" signs by the strong tag.
Parameters
string $text: The string to be filtered.
Return value
string The HTML source with emphasized text.
1 call to ReadmehelpMarkdown::convertDoubleUnderscore()
- ReadmehelpMarkdown::process in src/
Plugin/ Filter/ ReadmehelpMarkdown.php - Performs the filter processing.
File
- src/
Plugin/ Filter/ ReadmehelpMarkdown.php, line 484
Class
- ReadmehelpMarkdown
- Provides a filter for markdown.
Namespace
Drupal\readmehelp\Plugin\FilterCode
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);
}