This plugin is in alpha state. Please try it out and provide feedback.
yarn:
yarn add --dev prettier prettier-plugin-toml --dev --exact
npm:
npm install prettier prettier-plugin-toml --save-dev --save-exact
This plugin will be loaded automatically (if installed) by prettier to format files ending with .toml suffix. Using it is exactly the same as using prettier
- Prettier CLI usage docs.
- Prettier API usage docs.
Or clone an example npm package which uses prettier-plugin-toml.
A Prettier plugin must first parse the source code of the target language into a traversable data structure (Usually an Abstract Syntax Tree) and then print out that data structure in a "pretty" style.
Prettier-Toml uses a Toml Parser implemented in JavaScript using the Chevrotain Parser Building Toolkit for JavaScript. What this means is that unlike many other prettier plugins, prettier-toml has no additional runtime pre-requisites (e.g: Python executable). It could even be used inside a browser.
Contributions are very welcome! See the top level contribution guide for this mono-repo.