{ "schema_type": "object", "schema_version": "1.0", "name": "highlight", "path": "packages/ree_text/package/ree_text/functions/highlight.rb", "mount_as": "fn", "class": "ReeText::Highlight", "factory": null, "methods": [ { "doc": "Highlights one or more +phrases+ everywhere in +text+ by inserting it into\na :highlighter string. The highlighter can be specialized by passing :highlighter\nas a single-quoted string with \u0001 where the phrase is to be inserted (defaults to\n\u0001) or passing a block that receives each matched term. By default +text+\nis sanitized to prevent possible XSS attacks.If the input is trustworthy, passing false\nfor :sanitize will turn sanitizing off.\n\n highlight('You searched for: rails', 'rails')\n # => You searched for: rails\n\n highlight('You searched for: rails', /for|rails/)\n # => You searched for: rails\n\n highlight('You searched for: ruby, rails, dhh', 'actionpack')\n # => You searched for: ruby, rails, dhh\n\n highlight('You searched for: rails', ['for', 'rails'], highlighter: '\u0001')\n # => You searched for: rails\n\n highlight('You searched for: rails', 'rails', highlighter: '\u0001')\n # => You searched for: rails\n\n highlight('You searched for: rails', 'rails') { |match| link_to(search_path(q: match, match)) }\n # => You searched for: rails\n\n highlight('ruby on rails', 'rails', sanitize: false)\n # => ruby on rails", "throws": [ ], "return": "String", "args": [ { "arg": "text", "type": "String" }, { "arg": "phrases", "type": "Nilor[String, ArrayOf[String], Regexp]" }, { "arg": "opts", "type": "Ksplat[:highlighter? => String, :sanitize? => Bool]" }, { "arg": "block", "type": "Block" } ] } ], "links": [ { "target": "sanitize_html", "package_name": "ree_text", "as": "sanitize_html", "imports": [ ] } ] }