NGs String - String Squisher
Wrap long text into fixed-width lines without losing any of it
- formatted_text
- lines
Worth contrasting directly with this pack's NGs String Cutter: that one truncates - it throws away whatever doesn't fit within a length limit. This one reflows instead. Feed it a long block of text and a max line length, and it wraps the whole thing into multiple lines that each stay under that length, without dropping a single character. The README's one-liner: "Easy handling of logical line breaks within text."
How it works
It chops text into chunks no longer than maxlength, then joins those chunks back together using whichever separator linebreak specifies: LF for a normal newline, TAB for a tab character, or custom to use your own string via custom_break. You get two outputs from the same operation - the whole thing rejoined into one string (formatted_text), and the individual lines as a separate list (lines) so you can loop over them one at a time downstream - feeding each line into a per-line process, another TextBox, or a Discord post, rather than parsing the joined string back apart yourself.
The inputs and outputs that matter
text- the source string.maxlength- default 20, range 2–256, the per-line cap.linebreak- enum (custom/LF/TAB), defaultLF.custom_break(optional, default;) - only used whenlinebreakis set tocustom.
Outputs: formatted_text (STRING, the rejoined whole) and lines (STRING, a list - one entry per wrapped line).
Getting both a joined string and a list out of one node call is the actual convenience here - without it, you'd wrap text one way for display (joined, human-readable) and need to re-split it a second way for anything that processes line by line (feeding each caption variant to a separate node, posting one line at a time). This node does the wrapping once and hands you both shapes of the result, so you're not maintaining two slightly different wrapping passes that could drift out of sync with each other.
How to install it
ComfyUI Manager: search "NeoGriever," install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/NeoGriever/ComfyUI-NeoGriever
then restart. No dependencies, no downloads.
Common issues & troubleshooting
Changed custom_break and nothing happened. linebreak defaults to LF, so custom_break sits unused unless you explicitly switch the mode to custom - setting the custom string alone doesn't activate it.
Downstream node expects a single string, not a list. lines is a list output by design - make sure whatever consumes it is actually built to iterate over a list (a For Loop, a batch-aware node) rather than expecting one plain STRING, or route formatted_text instead if you just want everything back as one block.
Lots of short lines for a small maxlength. With the default maxlength of 20, a genuinely long paragraph produces a lot of lines - bump maxlength up if you're wrapping prose rather than short labels or tags.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| maxlength | INT | 202–256 | — |
| linebreak | COMBO | LF | 3 options: custom, LF, TAB |
| custom_breakopt | STRING | ; | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| formatted_text | STRING | — |
| lines | STRING | — |