Nodes/RF Nodes/Merge lines (STRING)
ComfyUI Node

Merge lines (STRING)

Slam several text inputs into one multi-line string

By foxtrot-roger·Created 3 years ago·Updated 2 years ago· 2
Merge lines (STRING)
    • lines
    text

    ComfyUI's text nodes are one-string-per-node, and a real prompt is rarely one string. It's usually a base prompt plus a subject plus a quality suffix, each living in its own text box. Merge lines (STRING) (RF_MergeLines) joins them into a single multi-line string, newline-separated - the pack's answer to "how do I combine several text inputs without writing a concatenate node for each pair."

    How it works

    The node is marked INPUT_IS_LIST, so the text input accepts multiple wired values as a list, and it joins them with "\n":

    return ("\n".join(text),)
    

    Give it three text nodes and you get one block:

    masterpiece, best quality
    a red fox in snow
    soft light, detailed fur
    

    Which is exactly the shape most prompt-assembly nodes and CLIP text encoders expect when they accept multi-line input. No separator options, no trimming - newline join, done.

    The inputs that matter

    • text - the strings to merge. Because of INPUT_IS_LIST, this accepts several incoming text wires at once. There's just the one input socket, but it takes a batch of values.

    Output: lines - the merged STRING, each input on its own line.

    When you'd use it

    Anywhere a downstream node wants one multi-line block from several sources. The practical one: building a prompt from modular text nodes so you can toggle sections on and off without editing a giant text box. It also pairs with the pack's own line-select nodes - merge a set of candidate lines, then feed the block to RF_AtIndexString or RF_OptionsString to pick one per run. Merge and select are two halves of the same workflow.

    Installing RF Nodes

    No dependencies, no models. Via ComfyUI Manager search "RF Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/foxtrot-roger/comfyui-rf-nodes
    

    Restart ComfyUI; it's under RF in the menu.

    Common issues

    • "One of my inputs is missing from the output." - With INPUT_IS_LIST, each wire you attach becomes one list element, so check every wire is actually connected; a loose input silently drops out.
    • "I wanted them on one line with commas." - This node only joins with newlines. For comma-joining, you'd concatenate with a separator in a text node instead.
    CategoryRF

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    linesSTRING