docs: add table of contents

This commit is contained in:
Johann Schopplich
2025-10-31 08:56:42 +01:00
parent b2eeaea9d0
commit 753ee2cefd
3 changed files with 25 additions and 8 deletions

View File

@@ -9,6 +9,22 @@ TOON's sweet spot is **uniform arrays of objects** multiple fields per row,
> [!TIP] > [!TIP]
> Think of TOON as a translation layer: use JSON programmatically, convert to TOON for LLM input. > 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? ## 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: 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 ██████████████░░░
``` ```
<details> <details>
<summary><strong>View detailed examples</strong></summary> <summary><strong>Show detailed examples</strong></summary>
#### ⭐ GitHub Repositories #### ⭐ GitHub Repositories
@@ -692,7 +708,7 @@ String values are quoted when any of the following is true:
> [!IMPORTANT] > [!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. > **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: 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] > [!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. > 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
<details>
<summary><strong>Show format examples</strong></summary>
``` ```
// Object // 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 { items: ['true', true] } → items[2]: "true",true
``` ```
## Ports in Other Languages </details>
## Other Implementations
- **.NET:** [toon.NET](https://github.com/ghost1face/toon.NET) - **.NET:** [toon.NET](https://github.com/ghost1face/toon.NET)
- **Dart:** [toon](https://github.com/wisamidris77/toon) - **Dart:** [toon](https://github.com/wisamidris77/toon)

View File

@@ -13,7 +13,6 @@
"@ai-sdk/openai": "^2.0.53", "@ai-sdk/openai": "^2.0.53",
"@ai-sdk/provider": "^2.0.0", "@ai-sdk/provider": "^2.0.0",
"@ai-sdk/xai": "^2.0.28", "@ai-sdk/xai": "^2.0.28",
"@antfu/eslint-config": "^6.1.0",
"@clack/prompts": "^0.11.0", "@clack/prompts": "^0.11.0",
"@faker-js/faker": "^10.1.0", "@faker-js/faker": "^10.1.0",
"ai": "^5.0.80", "ai": "^5.0.80",

3
pnpm-lock.yaml generated
View File

@@ -53,9 +53,6 @@ importers:
'@ai-sdk/xai': '@ai-sdk/xai':
specifier: ^2.0.28 specifier: ^2.0.28
version: 2.0.28(zod@4.1.12) 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': '@clack/prompts':
specifier: ^0.11.0 specifier: ^0.11.0
version: 0.11.0 version: 0.11.0