Nodes/ComfyUI 1hewNodes/Text Prefix Suffix
ComfyUI Node

Text Prefix Suffix

Wrap every line of text in a prefix and suffix, in one node

By 1hew·Created about a year ago·Updated 7 days ago· 33
Text Prefix Suffix
  • text
  • text
prefix
suffix

Every time you build a prompt workflow, you end up gluing text together: wrap a subject in parentheses for emphasis, tag every line with a LoRA trigger, add (masterpiece:1.2) to the start of a whole block. Text Prefix Suffix is the node that does the wrapping, and it does it per-line, which is the detail that makes it useful instead of trivial.

The mechanism is refreshingly blunt: whatever text you feed in, each line gets the prefix stuck on the front and the suffix on the end, and the result is re-joined with newlines. If you feed it a list instead of a single string, each list item gets the treatment and gets joined the same way. No wildcard magic, no substitution syntax to memorize - just "wrap each line."

The inputs

  • text - anything, typed *. Strings and lists both work; the node normalizes either into per-line/per-item handling.
  • prefix - prepended to every line. Default empty.
  • suffix - appended to every line. Default empty.

Output: text, a STRING with every line wrapped.

Where the per-line behavior pays off

Three quick uses, all of them built on the per-line semantics:

  • Prompt building: feed a multi-line list of style keywords, set prefix (, suffix :1.2), and every keyword comes out weighted.
  • Batch tagging: a list of filenames or class names, wrapped with a trigger or format token each.
  • Wildcard-style formatting: prefix {input}-style tokens around a list so the downstream parser sees the right shape without you retyping it.

The same per-line logic is why this node pairs well with the pack's Text List to String - that one joins with a separator you choose; this one applies prefix/suffix per item. Different tools, complementary.

Installing it

ComfyUI Manager, search "ComfyUI 1hewNodes", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

Standard pack note: the install pulls the repo's heavy requirements (opencv, rembg, ultralytics, transformers...) for the detection nodes; this text node uses none of them.

Gotchas

The per-line behavior is the thing people misjudge. If you feed a single-line string, you get one wrapped line - not the whole block split up. And it's a plain string wrapper, not a template engine: if you were hoping for {1}-style positional substitution, that's a different node (the pack's String Join Multi and String Filter do {input} substitution). Also remember the suffix goes after every line including the last, so a trailing comma or close-paren on the final line is your responsibility.

Category1hewNodes/text

Inputs (3)

NameTypeDefaultDescription
text*
prefixSTRING
suffixSTRING

Outputs (1)

NameTypeDescription
textSTRING