Skip to content

Commit

Permalink
Documentation for the web playground
Browse files Browse the repository at this point in the history
Also mentioned it's out-of-development status; resolves #875
  • Loading branch information
Xophmeister committed Mar 7, 2025
1 parent c8b4235 commit f021efa
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
6 changes: 1 addition & 5 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@

# The Topiary Playground

<!----------------------------------------------------------------------
TODO: Documentation for the web-based playground; see issue #875
----------------------------------------------------------------------->

- [TODO]()
- [Web playground](playground/web.md)
- [TTY playground](playground/tty.md)

# Guides
Expand Down
6 changes: 4 additions & 2 deletions docs/book/src/playground/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ The INPUT_SOURCE is optional. If not specified, it defaults to trying
to find the bundled integration test input file for the given language.
```

For example, the playground can be run in a terminal emulator pane, with
your editor of choice open in another.
The script itself is very basic -- that cannot be overstated! -- but it
provides a fast enough feedback loop to be useful. For example, the
playground can be run in a terminal emulator/multiplexer pane, with your
editor of choice open in another.

<div class="warning">
The use of inotify limits this tool to Linux systems, only.
Expand Down
38 changes: 38 additions & 0 deletions docs/book/src/playground/web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Web playground

<div class="warning">

As of October 2024, the WASM-based web playground is _not_ under active
development and has diverged from newer releases of Topiary. The web
playground is kept online, for demonstrative purposes, but newer
features have **not been implemented**.

Please see GitHub to [assess the divergence](https://github.com/tweag/topiary/compare/playground...main).

</div>

The [Topiary web playground](https://topiary.tweag.io/playground) is a
browser-based tool for experimenting with Topiary. It provides three
editor panes:

1. **Query:** This editor pane lets you define the Topiary formatting
queries to format the given language.

2. **Input:** This editor pane allows you to set the input code in the
given language.

3. **Output:** This editor pane (which is read only) shows the result of
Topiary formatting (i.e., the defined queries run against the input).

The given language is set by a drop-down at the top of the window.
Changing this will set the appropriate Tree-sitter grammar and populate
the "Query" and "Input" panes with the default formatting queries for
that language, as shipped with Topiary, and the sample testing input for
that language; the "Output" pane will then be generated appropriately.

By default, the web playground will format the input on-the-fly (i.e.,
on changes to either the "Query" or "Input" panes). This option can be
disabled with the appropriate checkbox and the "Format" button can be
used as an alternative. Otherwise, options are provides that mimic the
`--skip-idempotence` and `--tolerate-parsing-errors` flags to the
Topiary CLI (see [`topiary format`](../cli/usage/format.md)).

0 comments on commit f021efa

Please sign in to comment.