Skip to content

oxc-project/oxc-toml

Repository files navigation

oxc-toml

This is forked from Taplo for Oxfmt.

A TOML formatter library.

This library provides TOML formatting capabilities while preserving comments, whitespace, and the original document structure where appropriate.

Features

  • Format TOML documents according to configurable style options
  • Preserve comments and meaningful whitespace
  • Handle syntax errors gracefully
  • Fault-tolerant parsing using Rowan syntax trees

Usage

use oxc_toml::{format, Options};

const SOURCE: &str = "value=1\n[table]\nstring='some string'";

let formatted = format(SOURCE, Options::default());

Examples

Format all TOML files in a directory:

cargo run --example format_directory [PATH]

This example uses the ignore crate to walk a directory tree and format all TOML files, respecting .gitignore and other ignore files.

Attribution

This project is a formatter-only fork of the excellent Taplo project, originally created by Ferenc Tamás.

What Changed

This fork strips away all non-formatter components from Taplo, including:

  • CLI tool
  • Language Server Protocol (LSP) implementation
  • WebAssembly bindings
  • DOM (Document Object Model) for TOML manipulation
  • JavaScript/TypeScript packages
  • Editor integrations

The result is a focused, lightweight library that does one thing well: format TOML documents.

Original Taplo Project

Taplo is a comprehensive TOML toolkit that provides:

  • TOML v1.0.0 parser
  • Formatter (the foundation of this fork)
  • Language server for IDE integration
  • CLI tool for formatting and validation
  • WebAssembly bindings for browser/Node.js
  • Schema validation

If you need these features, please use the original Taplo project.

License

This project maintains the original MIT License from Taplo. See LICENSE for details.

Our sponsors

About

Taplo forked for Oxfmt

Resources

License

Stars

8 stars

Watchers

1 watching

Forks

Sponsor this project

Packages

 
 
 

Contributors