tin.highlight adds configurable markers around the text that produced the match. A match on pineapple returns '<b>pineapple</b>'. tin.highlight_ansi does the same with ANSI colors for a terminal.
tin.highlight(text [, begin_tag [, end_tag [, query]]])
tin.highlight(text, begin_tag, end_tag, query) → text
Returns document text with matched spans wrapped in tags. Highlighting marks exactly the text that produced the match. For
a BEFORE b, only the b occurrences that satisfy the relation are wrapped. Stemmed matches wrap the complete original word, so a query for runs highlights running as <b>running</b>.
Calls on a searched column use that index’s analysis options, including stemmer. Standalone calls accept the same analysis arguments as tin.tokenize. Supplied options must match the selected index when highlighting a searched column.
When query is omitted, the predicate is found anywhere in the same statement, including subqueries, CTEs, and DML (RETURNING, MERGE actions, ON CONFLICT).
Tag placeholders
begin_tag can carry two placeholders that TIN fills in for each highlighted span.
tin.highlight_ansi(text [, wrap_to [, query]])
tin.highlight_ansi(text, wrap_to, query) → text
Returns document text with ANSI color highlighting for matched spans.

