Expand description
Content classification for plain-text clipboard input.
Returns Text, Url, or Code. The caller must have already ruled out
image bytes via magic-byte sniffing — this module never returns Image.
Decision order (first match wins):
- trim; empty / > 64 KB → Text
- shebang
#!/...→ Code - whole-string URL parse with scheme allow-list → Url
{...}/[...]shape + valid JSON → Code- any line starts with a code-opener keyword → Code
- symbol-to-alphanumeric ratio > 0.20 with at least one code bigram → Code
- ≥ 2 distinct code bigrams → Code
- indented line(s) with a code bigram → Code
- otherwise → Text
Functions§
- detect
- Classify a plain-text clip. Never returns
Image.