(content: string)
| 42 | * Only applied to `text` command output (not html, forms, or structured data). |
| 43 | */ |
| 44 | export function datamarkContent(content: string): string { |
| 45 | const marker = ensureMarker(); |
| 46 | // Insert marker as a Unicode tag sequence between sentences (after periods followed by space) |
| 47 | // This is subtle enough to not corrupt output but detectable if exfiltrated |
| 48 | const zwsp = '\u200B'; // zero-width space |
| 49 | const taggedMarker = marker.split('').map(c => zwsp + c).join(''); |
| 50 | // Insert after every 3rd sentence-ending period |
| 51 | let count = 0; |
| 52 | return content.replace(/(\. )/g, (match) => { |
| 53 | count++; |
| 54 | if (count % 3 === 0) { |
| 55 | return match + taggedMarker; |
| 56 | } |
| 57 | return match; |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | // ─── Hidden Element Stripping (Layer 2) ───────────────────────── |
| 62 |
no test coverage detected