feat(docs): add YAML input to Playground with tests#303
Merged
johannschopplich merged 3 commits intoMay 17, 2026
Merged
Conversation
- Add input format selector and YAML parsing (YAML 1.2, merge keys off) - Extract parse/stringify helpers for testability and SPEC-aligned encoding - Add Vitest for docs package and playground parse tests - Update Playground copy in package README and ecosystem docs
3b327ac to
fc17284
Compare
- Inline parse/stringify helpers into the component, drop the separate parse-input module and its tests - Rename input state from `jsonInput`/`formattedJson`/`jsonTokens` to `inputText`/`formattedInput`/`inputTokens` so names no longer lie when YAML is selected - Hide the JSON Baseline selector in YAML mode and make the token-count tooltip conditional on input format - Store input under `state.input` with a fallback read of legacy `state.json` so existing share URLs keep working - Drop redundant YAML parse options (merge/version match library defaults); use lineWidth: 0 for editor display so long scalars do not fold mid-sentence - Remove the duplicated vitest devDep, docs vitest.config.ts, and `test` script – the playground is verified through the dev server
- "in real-time" → "in real time" (real-time only hyphenates as a compound modifier before a noun) - Header copy now matches the ecosystem page: "Convert JSON or YAML to TOON in real time" - Token-count tooltip unified across input formats; the JSON baseline selector is right next to it and already communicates the format - Drop `?? ''` fallback on state.input — decodeState already gates on successful JSON parse; the chain falls through to the legacy state.json field
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Closes #299
Description
This PR adds YAML input support to the playground along with parsing utilities, test coverage, and documentation updates for improved TOON playground interoperability.
Type of Change
Changes Made
Added an input format selector to the playground
Added YAML 1.2 parsing support with merge keys disabled
Extracted parse/stringify helpers into reusable utilities for improved testability
Updated encoding behavior to align with TOON SPEC requirements
Added Vitest configuration and coverage for:
playground parsing utilities
docs package behavior
YAML parsing edge cases
Updated Playground documentation in the README
Updated ecosystem docs to document YAML support and formatting behavior
SPEC Compliance
Testing
JSON ↔ YAML format switching
YAML 1.2 parsing behavior
Disabled merge key handling
Invalid YAML error handling
Parse/stringify helper behavior
SPEC-aligned encoding output
Pre-submission Checklist
Breaking Changes
Additional Context
This change improves the playground developer experience by supporting both JSON and YAML workflows while keeping parsing behavior deterministic and SPEC-compliant.