Multiline Prompt 📝
A prompt text formatter that also counts, numbers, and indexes your lines
- formatted_prompt
- total_lines
- line_count_info
- original_prompt
- indexed_line
- index_info
- lines_combo
Despite the "Prompt" in the name, this node doesn't encode anything and doesn't touch a model. It's a text formatter with a prompt-shaped purpose: you paste a multi-line prompt, and it cleans it up, re-joins the lines however you like, counts them, and can even pull out a single line by index. The output is plain text - you still wire it into a CLIP Text Encode yourself. Think of it as the polite middleman between "how you want to type a prompt" and "what the text encoder wants to receive."
What it does
Feed it multi-line text and it processes line by line: strips whitespace (optional), drops empty lines (on by default), and reconnects everything with a separator you choose - newline, comma, semicolon, space, or a custom one. That's the core trick: you can author a prompt as tidy bullet points and ship it to the encoder as a single comma-joined string, which is how most workflows actually want it.
Inputs that matter
- prompt_text - your multiline input. The one thing you'll always set.
- line_separator -
换行符(newline, keeps lines separate),逗号(comma),分号(semicolon),空格(space), or自定义(custom, where custom_separator takes over; default,). - remove_empty_lines / trim_lines - both on by default; turn off if you're preserving structure like paragraph breaks.
- add_line_numbers + line_number_format - prefixes each line with
1.,(1),[1],1:, or1 -. Mostly a debugging aid, honestly. - enable_index + line_index - grab one specific line (0-based) out of the batch. Useful when each line is a separate candidate prompt and you want to select by number.
Outputs
Seven of them, but you'll mostly touch three: formatted_prompt (the processed string - this is what you feed the text encoder), total_lines (an INT, handy for batch math), and original_prompt (the untouched input, for passing through). There's also line_count_info (a human-readable summary), indexed_line and index_info (the picked line and status when indexing is on), and lines_combo - a list output that some downstream nodes can turn into a dropdown selector, which is a nice touch for A/B testing lines.
Honest verdict
For pure line-cleaning and joining, plenty of nodes do this (even ComfyUI's core Text Multiline output behaves this way). The indexing and combo outputs are the differentiators, and they're genuinely handy if you're batch-selecting from a list of candidate prompts. If you just want to type a comma-joined prompt once and be done, you don't need it. If you're managing many short prompts, it earns its place.
Installing
Part of the ZMG pack. ComfyUI Manager → search "ZMG" / "ComfyUI-ZMG-Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/vanche1212/ComfyUI-ZMG-Nodes
cd ComfyUI-ZMG-Nodes
pip install -r requirements.txt
Restart, find it under ZMGNodes/text. No dependencies beyond the pack's base set - it's pure string processing.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt_text | STRING | — | |
| line_separator | COMBO | 换行符 | 选择输出时的行分隔符 |
| custom_separator | STRING | , | 当选择'自定义'分隔符时使用 |
| remove_empty_lines | BOOLEAN | true | 是否移除空行 |
| trim_lines | BOOLEAN | true | 是否去除每行的首尾空白字符 |
| add_line_numbers | BOOLEAN | false | 是否在每行前添加行号 |
| line_number_format | COMBO | 1. | 行号格式 |
| enable_index | BOOLEAN | false | 是否启用索引功能,获取指定行的数据 |
| line_index | INT | 00–9999 | 要获取的行索引(从0开始) |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| formatted_prompt | STRING | — |
| total_lines | INT | — |
| line_count_info | STRING | — |
| original_prompt | STRING | — |
| indexed_line | STRING | — |
| index_info | STRING | — |
| lines_combo | * | — |