Nodes/ComfyUI_Text_Tools_SG/Text Tools Merge Text-SG
ComfyUI Node

Text Tools Merge Text-SG

The merge node that lets you skip the string surgery

By ShammiG·Created 9 months ago·Updated 6 months ago· 7
Text Tools Merge Text-SG
    • merged_text
    order
    separator,
    insert_separator
    text1
    text2

    Combining two bits of text in ComfyUI shouldn't require a tangle of nodes, but the default answer - concatenate with + somewhere, or copy-paste and hope - is fiddly. Text Tools Merge Text-SG is the simple version: two text inputs, one output, and a couple of dropdowns that decide order and separator placement. If you build prompts from parts (subject + style + negative shared across many generations), this is the node you'll reach for, mostly because it makes the intent visible on the canvas instead of burying it in a formula.

    It's from the small ShammiG/ComfyUI_Text_Tools_SG pack - the same author as the markdown Editor and Viewer nodes - and it's about as uncomplicated as a ComfyUI node gets. No models, no API keys, no GPU. Pure string handling that works anywhere.

    The inputs that matter

    There are only a few, and two of them do the real work:

    • text1 / text2 - the two strings to join. Both optional, both multiline. Leave one empty and the other still passes through, which makes this a decent one-way passthrough in a pinch.
    • order - Text1 + Text2 or Text2 + Text1. No wire-swapping when you realize you want the style tag first.
    • separator - the glue, default ", ". Set it to a comma, a newline (type an actual line break in the box), and, or an empty string for straight concatenation.
    • insert_separator - where the separator goes: before, after, between, or any combination of those three. This is the bit people don't expect. It's meant for building wrapped text like "BEGIN " + text1 + text2 + " END" without writing the wrapper manually.

    The single output, merged_text, is a plain STRING you can wire into any text port - CLIP Text Encode, another merge node, a Save Text node, whatever.

    How it works

    Behind the scenes it's just string concatenation, but the "no need to disconnect noodles" detail is the part that keeps it useful: both inputs are optional, so you can wire in one or two sources, and disabling a source upstream doesn't break the node. The separator logic is exact - eight placements covering every combination of before/between/after - so what you see in the dropdown is literally what gets concatenated. If you pick Between, you get text1 + separator + text2; pick Before and After and the separator wraps the whole thing.

    Install and the one gotcha

    Same as every node in this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ShammiG/ComfyUI_Text_Tools_SG
    

    or install via ComfyUI Manager by searching ComfyUI_Text_Tools_SG, then restart. No dependencies beyond that - nothing to pip, nothing to download.

    The gotcha is pack-wide, not node-specific, but it'll bite you here first because this node is so simple: if you're on ComfyUI 0.3.76+, keep Nodes 2.0 turned off. The author ships custom frontend widgets and hasn't ported them to the new Vue renderer; the README's top warning says to disable it. For the pure merge node the backend will still run, but the custom widget rendering can break in Nodes 2.0 - and since you're here for the simple stuff, you want the legacy canvas.

    Is it a life-changer? No. It's a two-input concatenator with nice control over separators. But if you're assembling prompts from reusable fragments, or you've been wedging commas in with a formula node and squinting at the result, this does the job in plain view. One small caveat: for anything beyond two inputs, the same pack's Merge Text Multi version handles up to five - the two-input one is best when you want minimal clutter and a clear graph.

    Categorytext

    Inputs (5)

    NameTypeDefaultDescription
    orderCOMBO2 options: Text1 + Text2, Text2 + Text1
    separatorSTRING,
    insert_separatorCOMBO8 options: None, Before, After, Between, Before and After, Before and Between, +2
    text1optSTRING
    text2optSTRING

    Outputs (1)

    NameTypeDescription
    merged_textSTRING