Set Text Without Comments
Paste config text into ComfyUI without the comment lines
- str
Some of the text you want in a prompt or a metadata string doesn't come clean. You grab a style block from a config file or a training card and it's full of # comments, // notes, or /* */ block comments - the stuff that explains the content but absolutely shouldn't go into a prompt. This node strips comments before passing the text on, so you get the clean content and not the commentary.
How it works
One required input, str (multiline), plus optional prefix and suffix like the rest of the pack's Set Text family. The node runs the text through a comment stripper that handles three syntaxes:
- Python-style
#- everything after the#on a line is dropped - C/C++-style
//- same deal, line comment - Block comments
/* ... */- including multi-line blocks that span several lines
Non-empty lines are kept, blanked-out lines are dropped, and the result is returned with prefix and suffix wrapped around it as prefix + cleaned + suffix. It also collapses the input to only lines that still contain content after stripping, so a comment-heavy block becomes a tidy few lines.
Why you'd want it
The realistic use case is pasting text that's been annotated. LoRA cards, model cards, and config samples on Civitai and GitHub are littered with comments, and if you're building a prompt or metadata string from that raw text you'll drag # this makes the skin shiny straight into your conditioning. Run it through this node first and the noise disappears. It's also handy if you maintain your prompt templates with commented-out alternatives - keep the commentary in your source, strip it at the boundary.
Installing it
Part of the Sage Utils pack - ComfyUI Manager (search Sage Utils) or:
cd ComfyUI/custom_nodes
git clone https://github.com/arcum42/ComfyUI_SageUtils
cd ComfyUI_SageUtils
pip install -r requirements.txt
Restart ComfyUI. Only pip dependency is dynamicprompts; no model downloads.
The honest caveats
The stripper is mechanical, not smart. A # that's part of your actual text - say a hex color like #ff0000 in a fashion prompt - gets truncated mid-line, because it can't tell a comment marker from a hash. Same risk with // inside a URL. If your text is clean prose, don't route it through here; this node is for when you know there are comments to remove and you're willing to accept that it treats those characters as comment starts everywhere. That's the trade-off, and it's worth knowing before it eats your hex codes.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| str | STRING | Input value for str. | |
| prefixopt | STRING | Input value for prefix. | |
| suffixopt | STRING | Input value for suffix. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| str | STRING | Output value for str_out. |