You are here

public function ReadmehelpMarkdown::convertDoubleAsterisk 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::convertDoubleAsterisk()
ReadmehelpMarkdown::process in src/Plugin/Filter/ReadmehelpMarkdown.php
Performs the filter processing.

File

src/Plugin/Filter/ReadmehelpMarkdown.php, line 445

Class

ReadmehelpMarkdown
Provides a filter for markdown.

Namespace

Drupal\readmehelp\Plugin\Filter

Code

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);
}