https://github.com/un-ts/toml-tools
A set of tools for working with the Toml configuration file format.
https://github.com/un-ts/toml-tools
toml
Last synced: 2 months ago
JSON representation
A set of tools for working with the Toml configuration file format.
- Host: GitHub
- URL: https://github.com/un-ts/toml-tools
- Owner: un-ts
- License: mit
- Created: 2019-01-15T17:10:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-12T17:04:26.000Z (over 1 year ago)
- Last Synced: 2024-10-30T00:36:09.904Z (8 months ago)
- Topics: toml
- Language: JavaScript
- Homepage:
- Size: 1.43 MB
- Stars: 74
- Watchers: 5
- Forks: 10
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/un-ts/toml-tools/actions/workflows/release.yml)
[](https://raw.githubusercontent.com/un-ts/toml-tools/master/LICENSE)
[](https://github.com/prettier/prettier)# TOML-Tools
## Introduction
This [mono-repo][mono-repo] contains a **_set of tools for working with the [Toml][toml] configuration file format_**.
## Why
The common Toml related tooling are Toml -> Json compilers.
But compiling to Json is just one scenario of many,
lets consider some other potential use cases:- **Building a Toml Syntax Highlighter**.
- **Converting Toml to Yaml**.
- **Building a Toml Beautifier**.
- **Validating Toml versus a given schema**.
- **Providing content assist in a Toml file**.These scenarios cannot be implemented (well) using
most existing Toml to Json compilers, for example:- **Lost comments information**.
- How can we beautify or convert Toml to Yaml if we don't possess the comments information?
- **Lack of Token type & positioning information.**
- How could we syntax highlight(paint) parts of a Toml file if we do not know
where every single Token starts and ends (Commas/Parenthesis/Literals/...)?
- **Failing on the first error**
- How would we implement content assist on a Toml file currently being edited
if our parser fails on the first error?
- **Lack of full position information**
- How will we provide useful Schema validation errors if we lack full position information?
- Full position information would also be needed for the content assist scenario.## How
This mono repo will contain two types of packages.
- Low level **Infrastructure** (Toml Lexer & Parser implemented using [Chevrotain][chevrotain])
with advanced capabilities to support the complex scenarios described above.
- Toml (end user) **Tooling** (Beautifier/Compiler/Schema Validator/...) that would be implemented using
the advanced low level infrastructure packages mentioned above.## Status (Alpha)
Infrastructure packages:
- [@toml-tools/lexer](./packages/lexer)
- [@toml-tools/parser](./packages/parser)Tooling Packages:
- [prettier-plugin-toml](./packages/prettier-plugin-toml)
[toml]: https://github.com/toml-lang/toml
[mono-repo]: https://github.com/babel/babel/blob/master/doc/design/monorepo.md
[chevrotain]: https://github.com/Chevrotain/chevrotain