Remove Commented Text
Keep notes in your prompt without them reaching CLIP
- STRING
Ever want to leave yourself a note in a prompt - "don't push this above 1.3 or it burns" - or temporarily disable part of it without deleting the text? JNodes_RemoveCommentedText lets you comment out lines or fragments the way you would in code, then strips those comments out before the prompt hits the encoder. Mark a whole line with #, or wrap a chunk mid-line in ## like this ##, and it vanishes at inference while staying visible in your text box.
This is the node that makes JNodes' batch-commenting web feature actually do anything. The pack lets you hit a hotkey (ctrl+shift+/ by default) in any multiline text area to insert the comment token - but that only inserts the marker. Something has to remove the marked text before it reaches CLIP, and this is that something. Jared Therriault built both halves; they're meant to work together.
How it works
It scans your text and drops anything marked as a comment: entire lines beginning with the line-comment token, and any span enclosed between the start/end tokens on a line. Everything else passes through unchanged. So in a line like (worst quality:1.1), ## works ok but kills backgrounds ##, the (worst quality:1.1), survives and the note between the ## markers is removed. A line that's just # deformed disappears entirely. The tokens are all configurable, so if # clashes with something in your prompts you can change them.
The inputs and outputs
text(multilineSTRING) - your prompt, comments and all.starting_line_comment(default#) - lines starting with this are removed whole.enclosed_comment_start/enclosed_comment_end(both default##) - text between these on a line is removed.STRINGoutput - the cleaned prompt, ready for CLIP encoding.
How to install it
Via ComfyUI Manager: Install Custom Nodes, search "JNodes", install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/JaredTherriault/ComfyUI-JNodes
pip install -r ComfyUI-JNodes/requirements.txt
then restart ComfyUI. No model downloads.
Common issues & troubleshooting
Put it between your prompt text and the CLIP encode. The whole point is to clean the text before it's encoded. If this node sits after the encoder, or off to the side, your comments will still reach the model. Wire your raw prompt (or JNodes_StringLiteral) into this node, then its output into the text-encode.
The comment tokens have to match what you typed. If you set the batch-commenting hotkey to insert a different token than the node's default #, or you comment by hand with a symbol the node isn't configured for, nothing gets removed. Keep the JNodes setting's token and this node's starting_line_comment in agreement.
A stray # in your actual prompt gets eaten. Since a line beginning with # is removed wholesale, a prompt line that legitimately starts with # (or uses ## for emphasis in some other tool's syntax) will be stripped unexpectedly. If that bites, change the tokens to something you'd never use as real prompt text.
It doesn't touch parameter tags or whitespace. Removing <params:...> tags is JNodes_RemoveParseableDataForInference's job; trimming stray whitespace is JNodes_TrimAndStrip. This node only handles comments. Chain them if you want the full cleanup.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| starting_line_comment | STRING | # | — |
| enclosed_comment_start | STRING | ## | — |
| enclosed_comment_end | STRING | ## | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |