ComfyUI Node

Text Split

One big text box, a hundred prompts

By kursopiko·Created 6 months ago·Updated 6 months ago· 0
Text Split
    • list
    text
    skip_empty_linestrue

    Text Split does one boring thing: it turns a multiline text box into a list of strings, one per line. It sounds like a nothing node, and it is - until you realise it's the missing piece that lets you type ten prompts into one box and batch through them without building ten near-identical prompt nodes.

    How it works

    The mechanism is exactly what you'd guess from the name: the text is split on line breaks, and by default blank lines are dropped so you don't end up with empty entries polluting your list. That's the whole implementation - text.splitlines(), then filter if the toggle is on. Nothing clever, nothing hidden.

    Wiring it up

    The output, list, is typed STRING_LIST, not plain text. That distinction matters: you can't drag it straight into a CLIP Text Encode prompt field. The natural partner is List Get Index - also in this pack - which grabs one element by index. So the chain is:

    Text Split ──> List Get Index ──> CLIP Text Encode
    

    Type a dozen prompts, change the index between runs (or drive it from a seed or a counter node), and you've got prompt variation without duplicating nodes. This is the Comfy-native answer to the old A1111 wildcard habit, just without the {a|b|c} syntax.

    The inputs that matter

    Two inputs, both obvious:

    • text - multiline string, one prompt per line.
    • skip_empty_lines - boolean, default true. When on, blank lines vanish from the output; when off, they stay as empty strings.

    One output, list, of type STRING_LIST.

    Installing it

    Ships in jan-prompt-presets (https://github.com/kursopiko/jan-prompt-presets) by JAN (@kursopiko). Via ComfyUI Manager: search jan-prompt-presets, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kursopiko/jan-prompt-presets
    

    Restart ComfyUI afterwards. No dependencies, no models to download. The node appears under prompt/presets.

    Troubleshooting

    • "Can't connect these two nodes." You're almost certainly wiring the STRING_LIST output into a plain string input. Route it through a list-reading node like List Get Index instead.
    • Empty strings in your batch. Flip skip_empty_lines back on, or drop the blank lines in your text box. Some downstream nodes choke on empty prompt strings.
    • Only some lines show up. If you turned skip_empty_lines on and a line is pure whitespace, it's treated as blank and removed - that's the feature, not a bug.
    Categoryprompt/presets

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGEach non-empty line becomes one element in the output list.
    skip_empty_linesBOOLEANtrueWhen enabled, blank lines are excluded from the output list.

    Outputs (1)

    NameTypeDescription
    listSTRING_LIST