ComfyUI Node

PlaceholderPrompting

Macro placeholders for your prompts

By dothings·Created 11 months ago·Updated 11 months ago· 0
PlaceholderPrompting
    • parsed_text
    raw_text

    Every ComfyUI regular ends up with a prompt they paste over and over: the same character sheet, the same quality-tag block, the same lovingly described couch. This node is the answer to that. It's a tiny macro system for prompts - you write **killer_couch** in your prompt, and before the text reaches the CLIP encoder, the node swaps in whatever long description you've stored under "killer_couch". It's the same idea as the {this|that} bracket trick and A1111-era wildcards from the old days, except you define the expansions yourself in a plain JSON file instead of shuffling text files around.

    It's not flashy and it barely gets any search traffic, but that's fine - it's a personal-workflow hygiene tool, not a showpiece. If you already run Impact Pack, its ImpactWildcardProcessor does similar work with more moving parts. This one has exactly zero Python dependencies beyond the stdlib, which is worth something in an ecosystem where every other node ships a requirements.txt that fights your other nodes.

    How it works

    The mechanism is embarrassingly simple, and that's the appeal. On every run it opens placeholders/placeholders.json, which is a plain key/value dictionary:

    {
        "killer_couch": "a large, mainly green couch with plenty of cushions...",
        "marci": "marci, bangs, brown hair, brown eyes, ponytail, short ponytail,"
    }
    

    Then it runs two regex passes over your text: first it strips anything wrapped in ## ... ## (handy for temporarily commenting out a word or phrase without deleting it - placed in a ##livingroom## garden becomes "placed in a garden"), then it swaps every **key** for its stored value. The JSON file is re-read on every run, so you can edit it in a text editor while ComfyUI is open and get the new text on the next queue without reloading anything.

    One sharp edge worth knowing: if you type a placeholder that isn't in the JSON, the node leaves your text exactly as written and passes **typo_key** straight to the encoder. No error, no warning - just a prompt full of asterisks. Underscores matter, since that's how the example keys are written.

    The one input and the one output

    The node is minimal on purpose. There's a single raw_text input - a multiline text box where you type your prompt with **placeholders** in it - and a single parsed_text output, a STRING holding the fully expanded prompt. Wire that output into the text input on a CLIP Text Encode node and you're done. Run the node by itself (click its play button) if you want to preview the resolved text without generating anything; the node shows the result in a read-only preview box.

    Installing it

    ComfyUI Manager is the easy path - search for comfyui_placeholder_prompting and install. Or clone it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dothings/comfyui_placeholder_prompting
    

    Then the step everyone trips on: there's no placeholders.json yet, only placeholders_example.json. Rename it or copy it:

    cd comfyui_placeholder_prompting/placeholders
    cp placeholders_example.json placeholders.json
    

    Restart ComfyUI. The node shows up under prompting in the node menu as "easy prompting" (the class is PlaceholderPrompting). No models, no API keys, no extra installs.

    Common gotchas

    • File not found on first run. Forget the rename step above and the node dies with a file error, because it opens that path unconditionally. Fix the filename.
    • The path is relative. The code opens custom_nodes/comfyui_placeholder_prompting/placeholders/placeholders.json relative to your working directory, so it assumes you launch ComfyUI from its root folder. A launcher script that cds elsewhere before starting the server can break it. If it fails and your file clearly exists, that's why.
    • "Why is my CLIP node greyed out?" This is the README's FAQ, and it's expected behavior: when any node feeds text into CLIP Text Encode, the built-in text field greys out - but the incoming text is what actually gets encoded. To get the CLIP field back, disconnect the wire, edit, and reconnect.
    • Trailing comma in JSON. JSON hates a trailing comma after the last value, and the README calls this out - you'll get a parse error until you delete it.
    Categoryprompting

    Inputs (1)

    NameTypeDefaultDescription
    raw_textSTRINGThe text to be encoded.

    Outputs (1)

    NameTypeDescription
    parsed_textSTRING