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