Nodes/MD Nodes/MD: Advanced Text Input
ComfyUI Node

MD: Advanced Text Input

A text box that rolls dice for you

By MDMAchine·Created about a year ago·Updated 3 months ago· 15
MD: Advanced Text Input
    • processed_text
    • original_text
    • seed_used
    • selected_seed
    • text_length
    • wildcard_count
    text
    seed0
    seed_modefixed
    seed_list
    seed_offset0
    wildcard_modefalse
    strip_whitespacefalse
    lowercasefalse
    uppercasefalse
    remove_extra_spacestrue
    wildcard_syntaxcurly_braces
    debug_mode0 - Silent

    Plain text nodes are fine until you want a prompt that changes every run. AdvancedTextNode is the version that turns {red|blue|neon green} into an actual choice instead of a literal string - inline wildcards, seeded so you can reproduce a draw, with a pile of output wires that tell you exactly what happened.

    If you've used wildcard systems before, the syntax will feel familiar: with wildcard_mode on, {option1|option2} picks one option at random, and you can switch the syntax to __option1|option2__ double-underscore style if that's what your collection of wildcard files speaks. Every draw is deterministic from a seed, so the same seed gives the same pick every time.

    The inputs that matter

    There's a lot of surface here, but a beginner only touches a handful:

    • text - your prompt, template, YAML, whatever. Multi-line.
    • wildcard_mode - the master switch. Off, and the text passes through byte-for-byte; on, and {a|b} patterns get resolved.
    • seed and seed_mode - fixed for reproducibility, random for a fresh pick every run, increment for batch work where each run should advance the draw. The tooltip's suggestion of increment for batching is the right call.
    • seed_list - a separate wildcard string ({1234|5678|9012}) that injects seed numbers rather than words, output on the selected_seed wire. Leave empty unless you're scripting seed sequences.

    The rest is convenience: lowercase/uppercase (lowercase wins if both are on), strip_whitespace for cleaning pasted YAML, remove_extra_spaces (on by default, and you'll want it), and wildcard_syntax to pick the brace style.

    What comes out

    Six outputs, which is more than you'll usually wire up but useful when you need them:

    • processed_text - the resolved string. This is the one that feeds your CLIP Text Encode.
    • original_text - what you typed, untouched.
    • seed_used and selected_seed - the actual seed that ran, and the value drawn from seed_list.
    • text_length and wildcard_count - diagnostics, handy for debugging a prompt that's silently shorter than you think.

    A nice workflow pattern: run with seed_mode set to increment, batch a few images, and the prompt picks (and seeds) step forward in lockstep so you can see what each option produced. Wire seed_used into your KSampler seed for full reproducibility.

    Installing it

    It's part of MD Nodes (MDMAchine/ComfyUI_MD_Nodes). ComfyUI Manager: search MD_Nodes, install, restart. Or the manual route:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
    cd ComfyUI_MD_Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. The pack's requirements file pulls in a lot more than text processing needs (audio DSP, LLM integrations), but the one-liner is the supported path. Python 3.10+ and a current ComfyUI.

    Common issues

    People mostly trip on the obvious thing: typing {red|blue} and getting the literal string back. That's wildcard_mode being off - it's off by default, deliberately, so text passes through exactly as written. Flip it on and the pattern resolves. The other gotcha is expecting the double-underscore syntax to work while wildcard_syntax is set to curly_braces; pick one style and stick to it.

    CategoryMD_Nodes/Text

    Inputs (12)

    NameTypeDefaultDescription
    textSTRINGTEXT INPUT • Purpose: Main text input area for prompts, YAML, JSON, etc. • Usage: Type raw text or use wildcards like {option1|option2}. • Note: Multi-line compatible.
    seedoptINT00–9007199254740991RANDOM SEED • Purpose: Controls randomization for wildcard selection. • Range: 0 to 9,007,199,254,740,991 (JS Safe Max). • Note: Ignored if 'seed_mode' is set to 'random'. ⭐ Recommended: Fixed value for reproducible generation.
    seed_modeoptCOMBOfixedSEED MODE • Purpose: Defines how the seed updates per execution. • Options: - fixed: Uses the exact seed value provided. - random: Generates a new seed every run. - increment: Auto-adds 1 to the seed (great for batches). ⭐ Recommended: 'fixed' for testing, 'increment' for batching.
    seed_listoptSTRINGSEED LIST (WILDCARD) • Purpose: Randomly pick ONE seed from a wildcard string. • Example: {1234|5678|9012} or __42|777|1337__ • Output: Outputs chosen value to the 'selected_seed' INT. ⭐ Recommended: Leave empty unless injecting specific seeds.
    seed_offsetoptINT00–9007199254740991SEED OFFSET • Purpose: Adds an integer offset to the seed before processing seed_list. • Effect: Helps reduce repetition in batch workflows. ⭐ Recommended: 0.
    wildcard_modeoptBOOLEANfalseWILDCARD MODE • Purpose: Enable processing of {opt1|opt2} or __opt1|opt2__ patterns. • Effect: If disabled, text passes through exactly as written. ⭐ Recommended: True if writing dynamic prompts.
    strip_whitespaceoptBOOLEANfalseSTRIP WHITESPACE • Purpose: Removes leading/trailing whitespace from the ENTIRE block. ⭐ Recommended: False (unless cleaning bad JSON/YAML).
    lowercaseoptBOOLEANfalseFORCE LOWERCASE • Purpose: Converts entire output text to lowercase. • Note: Overrides 'Force Uppercase' if both are true. ⭐ Recommended: False.
    uppercaseoptBOOLEANfalseFORCE UPPERCASE • Purpose: Converts entire output text to UPPERCASE. ⭐ Recommended: False.
    remove_extra_spacesoptBOOLEANtrueREMOVE EXTRA SPACES • Purpose: Collapses multiple spaces into single spaces. ⭐ Recommended: True (keeps prompts clean).
    wildcard_syntaxoptCOMBOcurly_bracesWILDCARD SYNTAX • Purpose: Choose the pattern style for wildcard parsing. • Options: {curly_braces} or __double_underscore__. ⭐ Recommended: curly_braces.
    debug_modeoptCOMBO0 - SilentLOGGING VERBOSITY • Controls console output and parser profiling.

    Outputs (6)

    NameTypeDescription
    processed_textSTRING
    original_textSTRING
    seed_usedINT
    selected_seedINT
    text_lengthINT
    wildcard_countINT