Text Wrap
Synopsis
Wraps text to specified widths by inserting line breaks.
Schema
- text_wrap:
field: <ident>
width: <integer>
target_field: <ident>
indent: <string>
line_separator: <string>
break_long_words: <boolean>
preserve_lines: <boolean>
trim_whitespace: <boolean>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
| Field | Required | Default | Description |
|---|---|---|---|
field | Y | - | Source field containing text to wrap |
width | Y | - | Maximum line width in characters |
target_field | N | Same as field | Target field to store wrapped text |
indent | N | - | String to indent each line (e.g., " " for spaces) |
line_separator | N | \n | Line separator character |
break_long_words | N | false | Break words longer than width |
preserve_lines | N | false | Preserve existing line breaks |
trim_whitespace | N | false | Trim whitespace from lines |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if wrapping fails |
ignore_missing | N | false | Skip processing if referenced field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
Formats text by inserting line breaks at specified intervals to ensure lines don't exceed the maximum width. The processor can break at word boundaries for readability or at exact character positions for fixed-width requirements.
The processor supports various formatting options including custom indentation, line break characters, and word-boundary preservation.
When break_long_words is disabled (default), words longer than the specified width will not be broken. When enabled, long words will be split to fit within the width limit.
The processor handles Unicode characters correctly and counts display width rather than byte length, ensuring proper formatting for international text.
Very long words that exceed the specified width will remain unbroken unless break_long_words is enabled.
Examples
Basic Text Wrapping
Wrapping long text to 40-character lines... | |
creates formatted multi-line text: | |
Code Comment Formatting
Formatting code comments with indentation... | |
creates indented code comments: | |
Fixed-width Formatting
Creating fixed-width text without word breaks... | |
breaks at exact character positions: | |
Custom Line Breaks
Using custom line break characters... | |
uses custom separator: | |
Email Formatting
Formatting email content with line length limits... | |
formats for email standards: | |