Normalize Whitespace
text.normalize_whitespace
Overview
Normalizes whitespace deterministically: converts CRLF/CR to LF, strips trailing spaces, collapses repeated spaces/tabs, and applies a preservation policy (compact, preserve_lines, preserve_paragraphs, markdown_safe). Fenced code blocks are preserved by default and Markdown hard line breaks are kept in markdown_safe mode. Accepts file input via file_ref — no need to extract file content first.
Whitespace noise breaks comparison and dedup — we clean it deterministically so your pipelines get consistent text.
Reliability
STRICT and deterministic — identical text and options always yield identical output. Fenced code blocks are preserved verbatim when preserveCodeBlocks is true (default). Input validation (not retryable): unsupported mode; text and file_ref both missing.
Context footprint
Returns the normalized text and a small change summary. A successful call costs 1 execution credit.
When to use it
When you compare, hash, or deduplicate text and want predictable whitespace.
Do not use on whitespace-significant formats (some code, fixed-width tables) where every space carries meaning.
Scope
Non-goals
- Does not change words
- Does not translate
- Does not fix spelling
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 2 MiB | Skill maximum |
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | No | Bounded inline text source. Required unless file_ref is provided. |
| file_ref | string | No | Tenant-scoped opaque text-file reference. Omit it to use the required inline text; never send both. |
| mode | string | No | Preservation mode; omit it for preserve_paragraphs. |
| trim | boolean | No | Whether outer whitespace is trimmed; omit it for true. |
| normalizeNewlines | boolean | No | Whether CRLF and CR become LF; omit it for true. |
| collapseSpaces | boolean | No | Whether repeated spaces and tabs collapse; omit it for true. |
| preserveCodeBlocks | boolean | No | Whether fenced code blocks are preserved; omit it for true. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| ok | boolean | Yes | Always true for a successful normalization. |
| text | string | Yes | Normalized bounded text. |
| changes | object | Yes | Closed change-summary object with originalLength, normalizedLength, and newlineCountChanged properties. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"text.normalize_whitespace","input":{"text":"a b"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("text.normalize_whitespace", {"text":"a b\r\n\r\n\r\nc"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not change words
- Does not translate
- Does not fix spelling
- Whitespace-significant formats where every space matters
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "text.normalize_whitespace",
"input": {
"text": "a b\r\n\r\n\r\nc"
}
}Examples
Collapse spaces and normalize newlines
{
"text": "a b\r\n\r\n\r\nc"
}{
"text": "a b\n\nc",
"changes": {
"originalLength": 12,
"newlineCountChanged": true,
"normalizedLength": 6
},
"ok": true
}Markdown-safe mode preserves hard line breaks
{
"mode": "markdown_safe",
"text": "line one \nline two"
}{
"text": "line one \nline two",
"changes": {
"originalLength": 19,
"newlineCountChanged": false,
"normalizedLength": 19
},
"ok": true
}Recommended use cases
- Clean text before hashing/dedup
- Normalize prompts
- Tidy scraped text
Avoid for
- Whitespace-significant formats where every space matters
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.