method
highlight
v1.0.0 -
Show latest stable
-
0 notes -
Class: ActionView::Helpers::TextHelper
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (-1)
- 2.0.3 (38)
- 2.1.0 (-1)
- 2.2.1 (26)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (-3)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (-26)
- 4.1.8 (0)
- 4.2.1 (26)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (24)
- 5.1.7 (0)
- 5.2.3 (2)
- 6.0.0 (0)
- 6.1.3.1 (1)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (26)
- 7.1.3.4 (0)
- What's this?
highlight(text, phrase, highlighter = '\1')
public
Highlights the phrase where it is found in the text by surrounding it like <strong class="highlight">I’m a highlight phrase</strong>. The highlighter can be specialized by passing highlighter as single-quoted string with \1 where the phrase is supposed to be inserted. N.B.: The phrase is sanitized to include only letters, digits, and spaces before use.