Nodes/EBU Workflow/EBU Decode New Lines
ComfyUI Node

EBU Decode New Lines

Turn a single-line string back into real newlines

By burnsbert·Created about a year ago·Updated 12 months ago· 0
EBU Decode New Lines
    • decoded_text
    encoded_text
    new_line_encoding|||

    EBU Decode New Lines is the return half of the EBU Workflow pack's newline-encoding pair. Where EbuEncodeNewLines squashes multiline text into a single line by replacing \n with a token (default |||), this node does the reverse: it replaces that token with real newlines, restoring the original formatting.

    It exists because ComfyUI's string plumbing is full of nodes that are hostile to literal newlines - separators, switches, and text-manipulation nodes that treat a newline as a boundary. The encode/decode trick lets you smuggle multiline content through single-line machinery and reassemble it at the end, and this node is where you reassemble.

    How it works

    A pure, literal string replace: encoded_text.replace(new_line_encoding, "\n"). Inputs are encoded_text (STRING) and new_line_encoding (default |||); the single output decoded_text (STRING) is the multiline result. It's marked as an output node, so you can also drop it at the end of a chain just to display the restored text in the UI.

    The only real decision is the token. Whatever you encode with, you must decode with - there's no state shared between the two nodes, and nothing validates that they agree. If you encode with ||| and decode with ---, you get a string full of literal dashes and no newlines. Keep both nodes on the same token and it just works.

    Where it fits

    The canonical shape: a multiline prompt goes into Encode, gets flattened, travels through string-switch/join/filter nodes as a single line, then Decode restores the newlines before the text hits a conditioning or display node. It's also handy when you've pulled text out of a file or a widget that collapsed newlines into ||| (some tools do this as a storage convention) - decode it and the formatting comes back.

    One thing to remember: the token must not appear naturally in your content. If your text legitimately contains |||, decode will split where you didn't intend. That's the only real failure mode, and it's entirely avoidable by choosing a token your content never uses.

    Installing

    Same story as every node in this pack - the EBU Workflow repo has no dependencies beyond Python's standard library, and there are no model downloads. ComfyUI Manager (search "EBU Workflow"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/burnsbert/ComfyUI-EBU-Workflow
    

    then restart ComfyUI.

    Gotchas

    • Literal replacement, all occurrences, no escaping. Token collisions are on you.
    • Encode and Decode don't know about each other - mismatched tokens silently produce garbage. When in doubt, keep the defaults.
    • Decoding a string that was never encoded is harmless (it just may or may not contain the token), so this node is safe to drop into a flow defensively.
    CategoryUtility

    Inputs (2)

    NameTypeDefaultDescription
    encoded_textSTRING
    new_line_encodingSTRING|||

    Outputs (1)

    NameTypeDescription
    decoded_textSTRING