AnyText Formatter
Pull the quoted text out of your prompt for AnyText
- prompt
- texts
Small node, boring job, saves you a headache. AnyText needs two separate things from you: a scene prompt, and a list of the exact strings you want rendered as text. UL_AnyTextFormatter lets you write both in one natural sentence - you just quote the words you want drawn - and it splits them apart for you.
You write something like close-up of hakurei reimu sitting in a room, with text: "博丽灵梦" on the wall. and this node hands you back a clean prompt plus a LIST containing 博丽灵梦. That LIST is exactly the format UL_AnyTextEncoder wants on its texts input. Without this, you'd be assembling that list by hand.
How it works
There's no model here - it's pure string parsing. The node scans your prompt for the quoted segments (the bits inside quotation marks that follow the text markers), pulls them into an ordered list, and returns the prompt alongside that list. The order matters: the first quoted string maps to the first text region in your mask, and so on down the line. So if you're placing two lines of text, quote them in the order the regions appear.
The inputs and outputs that matter
There's really only one input worth talking about:
prompt(multiline STRING) - your scene description with the target words in quotes. The default in the box shows the pattern: a normal caption withtext: "..."fragments embedded. Follow that shape and it just works.
Two outputs:
prompt(STRING) - the caption, cleaned up, ready for the encoder'spromptinput.texts(LIST) - the extracted strings, in order, ready for the encoder'stextsinput.
Wire both into UL_AnyTextEncoder and you've done the tedious part of every AnyText graph.
How to install it
It ships with the pack, so if you have AnyText you have this. ComfyUI Manager, search ComfyUI_Anytext, or:
cd ComfyUI/custom_nodes
git clone https://github.com/zmwv823/ComfyUI_Anytext
then restart. No models, no fonts, no downloads - it's a parser.
Common issues & troubleshooting
The list comes out empty or short. The parser keys off quoted segments. If your quotes are curly/smart quotes pasted from a doc, or you forgot the quotation marks entirely, nothing gets extracted. Use straight quotes and keep the text: "..." shape from the default.
The text lands in the wrong region. List order equals region order. If line 2 shows up where line 1 should be, swap the order of your quoted strings - the formatter preserves whatever order you typed.
Do I even need it? Not strictly - the encoder takes a LIST on texts, and you could build that list with any string-list node. But this one is built to match AnyText's prompt convention, so it's the path of least friction. It's plumbing, not magic, and that's the whole appeal.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | close-up of hakurei reimu sitting in a room, with text: "博丽灵梦" on the wall. close-up of 18yo beautiful chinese girl, standing in a county yard, with text: "emm" and "博丽灵梦" in the background. | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| texts | LIST | — |