Skip to content

Commit

Permalink
This branch allows you to specify attributes to be added to the tag u…
Browse files Browse the repository at this point in the history
…sed to highlight search terms. So besides the tag to be used (<em> by default) you can specify attributes like class="term", title="You searched for this." or style="color: red;" all in array format, where the key is the attribute name and the value is the attribute value.
  • Loading branch information
marqu3s committed Feb 16, 2018
1 parent f6a67e4 commit d5bf072
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Support/Highlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function highlight($text, $needle, $tag = 'em', $options = [])
}
}

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

// Select pattern to use
Expand Down

0 comments on commit d5bf072

Please sign in to comment.