Prompt Editor
A tiny prompt template language with variables and comments
- prompt
Prompt Editor is the pack's answer to a very specific annoyance: rewriting the same prompt by hand every time you want to change one detail. It's a miniature template engine - you write a prompt source with variables and comments, it strips the comments, substitutes the variables, and hands you a clean final string. Think of it as a String.Format-style preprocessor that lives in your graph.
It sits in a real workflow spot. If you maintain reusable prompt blocks, or you've got a base scene you keep regenerating with one swapped detail, this node lets you keep the template human-readable (with actual comments explaining what each block does) and get a finished prompt out the other side. It's not a prompt enhancer and it doesn't call any LLM - the processing is deterministic text substitution.
How it works
The input is a single field, prompt_code, and the syntax is a mini-language with three rules, all readable straight from the parser:
- Comments -
//for line comments,/* ... */for block comments. They're stripped before anything else, so you can annotate your templates without polluting the output. - Variables - any
name = valueline before the prompt block becomes a variable. Values can be quoted with"or', and the quotes get stripped. - The prompt block - the first
prompt = { ... }(orprompt { ... }) block is the template body. Placeholders like{name}are replaced with the matching variable. The block can span multiple lines.
The README's example captures it perfectly:
# Variables
character = cinematic portrait of a young woman
location = neon street at night
style = soft rim light, shallow depth of field, highly detailed
# Prompt body
prompt = {
A realistatic photo.
{character}. She is in a {location}.
{style}.
}
produces:
A realistatic photo.
cinematic portrait of a young woman. She is in a neon street at night.
soft rim light, shallow depth of field, highly detailed.
The gotchas
Three, all grounded in the parser's actual behavior:
- Only the first
prompt = { ... }block is used. Anything after it is ignored. One template per input - put a second block in and it silently won't happen. - Variables must be defined above the block. The parser stops collecting
name = valuelines at the first prompt-block line. Define everything beforeprompt = {. - Unknown placeholders are left as-is. If
{name}has no matching variable, the literal{name}stays in your prompt. That's arguably good - it fails loudly in your output rather than silently - but it means a typo in a variable name shows up as raw braces in the generated prompt, and you have to spot it.
Also: prompt is a reserved word, so you can't use it as a variable name, and variable names must be plain [A-Za-z_][A-Za-z0-9_]*. Keep names simple and you're fine.
Wiring it up
Single output: prompt (STRING). It feeds any prompt input - the pack's BananaStudio, a CLIP Text Encode, whatever. The natural workflow is: one PromptEditor per template you maintain, wire the output into the generator, and edit the template instead of hand-assembling prompts every run.
Install
It's part of tjcccc/comfyui_banana_studio, so the standard install:
cd ComfyUI/custom_nodes
git clone https://github.com/tjcccc/comfyui_banana_studio.git
Restart ComfyUI (or search "Banana Studio" in ComfyUI Manager). No models, no pip dependencies, no API key - this is pure text processing and it runs fully offline.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt_code | STRING | The main prompt text to be edited. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |