README
Prettier for Graphviz Dot
prettier-plugin-dot is a prettier plugin for Graphviz Dot.
Format your Dot using Prettier.
How it works
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.
The Graphviz Dot AST generated by @ts-graphviz/parser implemented in JavaScript using the peggy. What this means is that unlike many other prettier plugins, prettier-plugin-dot has no additional runtime pre-requisites (e.g: Python executable). It could even be used inside a browser.
Getting started
If you're using the npm or yarn CLI, then add the plugin by:
# yarn
$ yarn add -D prettier prettier-plugin-dot
# or npm
$ npm install --save-dev prettier prettier-plugin-dot
The prettier executable is now installed and ready for use:
$ yarn run prettier --write '**/*.dot'
# or
$ npx prettier --write '**/*.dot'
Example
Input
digraph G {Hello->World}
Output
digraph G {
Hello -> World;
}
See Also
Graphviz-dot Test and Integration
- @ts-graphviz/parser
- Graphviz dot language parser for ts-graphviz.
- ts-graphviz
- Graphviz library for TypeScript.
- @ts-graphviz/react
- Graphviz-dot Renderer using React.
- jest-graphviz
- Jest matchers that supports graphviz integration.
- setup-graphviz
- GitHub Action to set up Graphviz cross-platform(Linux, macOS, Windows).
Contributors
Thanks goes to these wonderful people (emoji key):
Yuki Yamazaki 📖 ⚠️ 💻 |
Chris Wilkinson 🐛 |
Irakli Safareli 🤔 |
This project follows the all-contributors specification. Contributions of any kind welcome!
License
This software is released under the MIT License, see LICENSE.