D2 Filename Template2
The multiline version of the D2 string builder
- STRING
If you've already read about D2 Filename Template, this is that node with one difference: the format field is multiline. Same template engine, same arg sockets, same sanitization - just room to breathe. The single-line version is fine for anima_%date{yyyy-MM-dd}%, but once you're stacking a date, a checkpoint name, a resolution pulled from another node, and a seed, you'll be glad the multi-line box exists.
It's the kind of "second version of the same node" the D2 pack is honest about shipping: same code, subclassed, just a bigger text box. The author calls it out in the docs exactly that way - "Multiple line support version of D2 Filename Template."
What stays the same
format- the template string with%date:{yyyy/MM/dd/hh/mm/ss}%,%node:{id}.{key}%,%arg_1%, and%arg_1:ckpt_name(drops.safetensors), just written over multiple lines.arg_count- dials in 1 to 50arg_Ninput sockets.normalization- filename sanitization, default on.seed- lets you vary output per run.
It also keeps the power features: pull from arrays (%exec_1[0]%), dicts (%exec_1['key']%), and objects (%exec_1.key%), and use the presets editable in config/template_config.yaml. Output is a single STRING, ready to feed a save node's filename prefix or anything else that wants text.
Installing it
It's in the D2 pack. ComfyUI Manager → search "D2-nodes-ComfyUI" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI
Restart ComfyUI. No models, no heavy deps - just piexif and charset-normalizer. Since v32.0.0 the pack targets ComfyUI's V3 schema, so older ComfyUI installs should pin the pack to before 32.0.0.
The only real gotcha
Multiline strings and filenames don't mix. normalization handles the usual illegal characters, but if you're building an actual filename, keep newlines out of the result - use the multiline box for readability, not to inject carriage returns into a file name. And like the original, the arg sockets only materialize once you set arg_count. Everything else is literally the same node, so pick this one if your format string will ever exceed one line.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| format | STRING | Datetime -- %date:{yyyy/MM/dd/hh/mm/ss}% Node param -- %node:{id}.{key}% arg_1-3 -- %arg_1% Delete .safetensors -- %arg_1:ckpt_name | |
| arg_count | INT | 31–50 | — |
| normalization | BOOLEAN | true | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |