Skip to content

Commit

Permalink
Merge pull request teamtnt#133 from marqu3s/highlighter-tag-options
Browse files Browse the repository at this point in the history
Insert a space between the tag and the first attribute.
  • Loading branch information
nticaric authored Feb 19, 2018
2 parents 678d80c + cafbad8 commit 6d8dba5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Support/Highlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ public function highlight($text, $needle, $tag = 'em', $options = [])
{
$this->options = array_merge($this->options, $options);

$tagAttributes = ' ';
$tagAttributes = '';
if (count($this->options['tagOptions'])) {
foreach ($this->options['tagOptions'] as $attr => $value) {
$tagAttributes .= $attr . '="' . $value . '" ';
}
$tagAttributes = ' ' . trim($tagAttributes);
}

$highlight = '<' . $tag . trim($tagAttributes) .'>\1</' . $tag . '>';
$highlight = '<' . $tag . $tagAttributes .'>\1</' . $tag . '>';
$needle = preg_split('/\PL+/u', $needle, -1, PREG_SPLIT_NO_EMPTY);

// Select pattern to use
Expand Down

0 comments on commit 6d8dba5

Please sign in to comment.