ComfyToolkit

Code Formatter

Format source code with Prettier.

Source
1
Formatted
1

YAML Formatter

Run Prettier over YAML, with the parser preselected here.

YAML indentation is structural rather than cosmetic, so normalising it consistently is worth more than it is in most formats.

Tabs are fatal

YAML forbids tabs as indentation outright. An editor that inserts one produces a file that will not parse, and the resulting error rarely points at the tab. Formatting normalises everything to spaces, which is the quickest way to eliminate the problem.

Formatting does not fix types

Prettier reformats layout; it does not requote values. A bare NO is still going to parse as a boolean, and a version of 1.20 is still going to lose its trailing zero. Converting to JSON is what surfaces those, not formatting.

Multi-document files and long strings

A file containing several documents separated by --- is preserved as separate documents rather than merged, which matters for Kubernetes manifests that bundle a deployment and a service together.

Block scalars written with | or > keep their form, because the choice between them changes whether newlines survive. Prettier will not silently convert one to the other.

Anchors and aliases survive

Anchors and their aliases are preserved rather than expanded, because expanding them would duplicate the structure they exist to share and quietly change the file.

That differs from converting YAML to JSON, where anchors necessarily get resolved because JSON has no equivalent construct.

Quoting is left as you wrote it

Prettier does not add or remove quotes around scalar values, because in YAML quoting changes type. Adding quotes to a bare NO would turn a boolean into a string and silently alter the config.

That means formatting cannot rescue you from the type-inference traps. It normalises layout and nothing else, which is precisely what you want from a formatter here.

Open the full Code Formatter