From 753ee2cefd4ede663b5a3a441a2682c8eb4b16bd Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 31 Oct 2025 08:56:42 +0100 Subject: [PATCH] docs: add table of contents --- README.md | 29 +++++++++++++++++++++++++---- benchmarks/package.json | 1 - pnpm-lock.yaml | 3 --- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8ae7f1e..f22c128 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,22 @@ TOON's sweet spot is **uniform arrays of objects** – multiple fields per row, > [!TIP] > Think of TOON as a translation layer: use JSON programmatically, convert to TOON for LLM input. +## Table of Contents + +- [Why TOON?](#why-toon) +- [Key Features](#key-features) +- [Benchmarks](#benchmarks) +- [📋 Full Specification](./SPEC.md) +- [Installation](#installation) +- [CLI](#cli) +- [Quick Start](#quick-start) +- [Format Overview](#format-overview) +- [API](#api) +- [Using TOON in LLM Prompts](#using-toon-in-llm-prompts) +- [Notes and Limitations](#notes-and-limitations) +- [Syntax Cheatsheet](#syntax-cheatsheet) +- [Other Implementations](#other-implementations) + ## Why TOON? AI is becoming cheaper and more accessible, but larger context windows allow for larger data inputs as well. **LLM tokens still cost money** – and standard JSON is verbose and token-expensive: @@ -84,7 +100,7 @@ Total ██████████████░░░ ```
-View detailed examples +Show detailed examples #### ⭐ GitHub Repositories @@ -692,7 +708,7 @@ String values are quoted when any of the following is true: > [!IMPORTANT] > **Delimiter-aware quoting:** Unquoted strings never contain `:` or the active delimiter. This makes TOON reliably parseable with simple heuristics: split key/value on first `: `, and split array values on the delimiter declared in the array header. When using tab or pipe delimiters, commas don't need quoting – only the active delimiter triggers quoting for both array values and object values. -## Type Conversions +### Type Conversions Some non-JSON types are automatically normalized for LLM-safe output: @@ -911,7 +927,10 @@ Task: Return only users with role "user" as TOON. Use the same header. Set [N] t > [!TIP] > For large uniform tables, use `encode(data, { delimiter: '\t' })` and tell the model "fields are tab-separated." Tabs often tokenize better than commas and reduce the need for quote-escaping. -## Quick Reference +## Syntax Cheatsheet + +
+Show format examples ``` // Object @@ -954,7 +973,9 @@ Task: Return only users with role "user" as TOON. Use the same header. Set [N] t { items: ['true', true] } → items[2]: "true",true ``` -## Ports in Other Languages +
+ +## Other Implementations - **.NET:** [toon.NET](https://github.com/ghost1face/toon.NET) - **Dart:** [toon](https://github.com/wisamidris77/toon) diff --git a/benchmarks/package.json b/benchmarks/package.json index db2d2cf..44f3fb2 100644 --- a/benchmarks/package.json +++ b/benchmarks/package.json @@ -13,7 +13,6 @@ "@ai-sdk/openai": "^2.0.53", "@ai-sdk/provider": "^2.0.0", "@ai-sdk/xai": "^2.0.28", - "@antfu/eslint-config": "^6.1.0", "@clack/prompts": "^0.11.0", "@faker-js/faker": "^10.1.0", "ai": "^5.0.80", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d586295..275787a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,9 +53,6 @@ importers: '@ai-sdk/xai': specifier: ^2.0.28 version: 2.0.28(zod@4.1.12) - '@antfu/eslint-config': - specifier: ^6.1.0 - version: 6.1.0(@vue/compiler-sfc@3.5.22)(eslint@9.38.0(jiti@2.6.1))(typescript@5.9.3)(vitest@4.0.3(@types/debug@4.1.12)(@types/node@24.9.1)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.1)) '@clack/prompts': specifier: ^0.11.0 version: 0.11.0