(s: string)
| 65 | // One pass instead of 10× includes scans. |
| 66 | const MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /; |
| 67 | function hasMarkdownSyntax(s: string): boolean { |
| 68 | // Sample first 500 chars — if markdown exists it's usually early (headers, |
| 69 | // code fence, list). Long tool outputs are mostly plain text tails. |
| 70 | return MD_SYNTAX_RE.test(s.length > 500 ? s.slice(0, 500) : s); |
| 71 | } |
| 72 | function cachedLexer(content: string): { |
| 73 | tokens: Token[]; |
| 74 | cacheKey?: string; |