Skip to content

ts-graphviz/prettier-plugin-dot

Repository files navigation

NodeCI npm version License: MIT PRs Welcome tested with jest code style: prettier All Contributors

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 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:

NPM

# 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;
}

Related Projects 💫

Related projects can be found at ts-graphviz GitHub Organization.

The TypeScript/JavaScript ecosystem provides a variety of OSS with the goal of making Graphviz more connected and easier to use.

Contributors 👥

Thanks goes to these wonderful people (emoji key):

Yuki Yamazaki
Yuki Yamazaki

📖 ⚠️ 💻
Chris Wilkinson
Chris Wilkinson

🐛
Irakli Safareli
Irakli Safareli

🤔
Michael Bock
Michael Bock

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

How to Contribute 💪

The easiest way to contribute is to use the library and star repository.

Questions 💭

Feel free to ask questions on GitHub Discussions.

Report bugs / request additional features 💡

Please register at GitHub Issues.

Development / Bug Fixes 🧑‍💻

See CONTRIBUTING.md.

Financial Support 💸

Please support core member kamiazya.

Note Even just a dollar is enough motivation for me to develop 😊

License ⚖️

This software is released under the MIT License, see LICENSE.