Nodes/ComfyUI Smart Helper Nodes/Smart Remove Comments
ComfyUI Node

Smart Remove Comments

The one-trick node that saves you from comment pollution

By slvslvslv·Created 2 years ago·Updated about 23 hours ago· 3
Smart Remove Comments
    • STRING
    text

    Smart Remove Comments is the pack's smallest node, and it does exactly one thing: takes a string, deletes everything from // to the end of each line, drops the lines that become empty, and returns the cleaned string. That's it. One input, one output. If you're used to ComfyUI nodes that grow a new menu of options every week, this is refreshingly dumb - which is also why it's worth having.

    The use case is real even though the node is trivial. The // comment convention has quietly taken over prompt boxes across the WAN and HunyuanVideo workflow scenes - people annotate their prompts with notes like // subject is holding a mug, keep the mug or // cinematic lighting, 50mm so the workflow is readable when shared. Those comments are great documentation and terrible model input. If your text encoder gets them raw, the words actually influence the generation - you end up with the model hallucinating "keep the mug" or "50mm" as if they were real prompt tokens. Smart RemoveComments is the inline filter that strips all of that before it reaches the encoder.

    You'd typically slot it between wherever your prompt text comes from and the CLIPTextEncode or other text consumer. Since it's a plain STRING-in / STRING-out node, it composes with anything - you can chain it after a wildcard expander, a text switcher, or before a SmartPrompt's output, and its cleaned text feeds any node that accepts a string.

    One honest limitation: it's a single string at a time, no batch, and it only understands the // style. A line like cat // the cat sits becomes just cat, and a fully commented line vanishes entirely (empty lines are dropped). That's usually the desired behavior, but if you want the comment kept for display while the model gets the clean version, pair it with a node that shows its input - or just use SmartPrompt, which shows the highlighted text and strips comments in one go.

    There's no real mechanism to dig into and no failure modes beyond the obvious "I expected my comment to show up" one. It's a utility node in the same pack as the rest of the Smart Helper set, with the same trivial install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/slvslvslv/ComfyUI-SmartHelperNodes
    # or search "Smart Helper Nodes" in ComfyUI Manager
    

    Restart ComfyUI and you're done. The pack's requirements.txt is empty, so there's nothing to install and no version conflicts to chase. If you find yourself stripping // comments by hand or watching them leak into generations, this is the two-minute fix.

    CategorySmartHelperNodes

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING