Nodes/Text Node With Comments (@cdxoo)/Text Node With Comments (@cdxoo)
ComfyUI Node

Text Node With Comments (@cdxoo)

Write notes in your prompt, not in your latent

By cdxOo·Created 2 years ago·Updated 2 years ago· 2
Text Node With Comments (@cdxoo)
    • STRING
    string

    You've got a workflow that lives or dies by its prompt, and the prompt box is a wall of text you can no longer read. You want to annotate it - // subject here, /* outfit */ there - without those words leaking into the conditioning. That's the whole job of this node. It's a plain multiline text node that strips C-style comments (// line comments and /* ... */ blocks) from your string before anything downstream sees it.

    It exists because a text encoder is not a language model that shrugs off noise; it tokenizes whatever you give it. Drop a // into a CLIP Text Encode input and the tokenizer eats those slashes as garbage tokens. Sometimes that's harmless, sometimes it nudges the result in ways you can't predict. This node lets you keep your notes inside the prompt where you'll actually see them, then quietly removes them at the last step. Given how much of ComfyUI culture is "drag the workflow into the canvas and read it," that's a genuinely nice fit - the pack README sums it up in one line: "multiline text node that strips comments before passing output down stream."

    How it works

    The whole pack is one node, one function, and a ~15-line regex in remove_comments.py. It matches // through end of line and /* ... */ across lines, and replaces them with an empty string. The clever bit: the regex also matches quoted strings ('...' and "...") and returns them untouched, so a "http://..." in your prompt or a line like the sign says "// no parking" survives intact.

    One design note worth knowing: the author deliberately strips comments to an empty string rather than a space, and even left a comment in the source saying they don't care about pathological C expressions like int/**/x=5. For your use case that's the right call - your newlines survive (only the comment characters are removed), so multi-line prompts keep their line structure, which some text encoders treat as meaningful. In other words: // note becomes an empty line, not a //note run-on.

    The inputs and outputs

    There's exactly one of each, and nothing to tune. Honestly, that's the appeal.

    • string - a multiline STRING field, empty by default. Paste your prompt, comments and all. This is the only input.
    • STRING (output) - the same text with comments removed, ready to wire into the text slot of a CLIP Text Encode node, a LoRA loader's trigger-word field, a filename generator, anywhere a string goes.

    Installing it

    The easy way: ComfyUI Manager → install missing custom nodes (or search "Text Node With Comments"), pick it, restart. The manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cdxOo/comfyui-text-node-with-comments
    

    Then restart ComfyUI. That's the entire install - pyproject.toml declares zero dependencies, there are no model files, no pip extras, no weights to download. It's stdlib-only, so this is one of the rare custom nodes that can't break your environment.

    Common issues

    • It's not a conditioning node. It outputs a STRING, so it can't plug into the conditioning input of a sampler - it goes into text slots. Beginners hit this constantly; if your connection turns red, route it into CLIP Text Encode's text input instead.
    • Order matters. It sanitizes text, not embeddings. It has to sit before the text encoder. Put it after and your comments are already tokens.
    • It only knows C-style comments. // and /* */ get stripped; # or -- lines pass straight through. And a // inside quotes is protected by design - that's not a bug, that's the regex doing its job.

    The honest caveat: this is a niche utility with essentially zero community footprint - nobody's building workflows around it, and it won't show up in "must-have nodes" lists (that's rgthree and Impact Pack territory). If you'd rather keep your annotations in a separate notes node, you can skip it. But if you specifically want the notes to ride along in the prompt text, this does exactly one thing and does it with zero dependencies and zero risk. Sometimes that's exactly the node you want.

    Categoryprimitives

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING