import type { ReactNode } from 'react'
/**
* Render a server-side `ts_headline` snippet (whose matched terms are wrapped in
* literal `…` markers) as highlighted React nodes WITHOUT
* dangerouslySetInnerHTML: split on the markers and wrap the odd segments in
* , so every text segment is React-escaped and the raw transcript/decision
* body can never inject markup.
*
* This is the canonical match-evidence renderer shared by every filtered surface
* (search tiles, decision/cause cards, policy-question meetings). The backend
* produces the `` snippet; callers pass it straight through.
*/
export function highlightSnippet(text: string): ReactNode {
return text.split(/<\/?mark>/).map((seg, i) =>
i % 2 === 1 ? (
{seg}
) : (
{seg}
),
)
}