Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking: Redesign Documentation #217

Closed
56 tasks done
adamziel opened this issue Apr 27, 2023 · 11 comments
Closed
56 tasks done

Tracking: Redesign Documentation #217

adamziel opened this issue Apr 27, 2023 · 11 comments

Comments

@adamziel
Copy link
Collaborator

adamziel commented Apr 27, 2023

Description

With so many API changes recently merged, the current documentation is largely outdated. Let's revamp it with specific use-cases in mind. I'd like to directly answer questions like:

@adamziel
Copy link
Collaborator Author

adamziel commented Apr 27, 2023

cc @eliot-akira @akirk @johnhooks @michalczaplinski @sejas @dmsnell – I'd love to include any information you see fit in the above documentation outline. For inspiration: anything that made you go "hmmm" or "wtf?!" or "wait, how do I..." while you've been working with WordPress Playground is likely a good candidate.

@johnhooks
Copy link

That looks like a very thorough list! I for one would love to learn about the internals and concepts. I'm glad you are keeping that in mind, it would be easy to gloss over and just document the public APIs.

From the perspective of someone wanting to use this to showcase a plugin or theme:

  • Fully document all the available the blueprint options and steps. The API for these is so thoughtful and elegant, I imagine blueprints will be a very popular way to configure a custom playground.

    • These might need to be documented by hand.

    • For popular use, I would assume it shouldn't have any generic type signtures in the general explanations of their use, the generated API docs can provide that amount of detail.

    • It would be really nice to have direct links between the simplified and complex documentation.

    • In my opinion, having all the available steps listed on the same page, with a table of contents, would make it fast to search and use as a reference while writing a blueprint.

  • Same type of documentation for the URL API of the index.html

  • In the current documentation, the concept between index.html and remote.html is hard to make sense of, especially if all your wanting to do is quickly get started. It would be nice if:

    • They had more descriptive names. Not the literal files, but the concepts, and the file names become just details about the concepts, rather than the other way around.

    • The current page explaining them feels dense, index-html-vs-remote-html. As simple as it sounds, more line height would give the concepts a bit more visual space between each other.

    • The top section of the page should be a large prioritize bullet point lists of use cases for each with directly links to how to do it.

    • The heavy technical details can be lower down the page.

@adamziel
Copy link
Collaborator Author

This is awesome, thank you @johnhooks!

They had more descriptive names. Not the literal files, but the concepts, and the file names become just details about the concepts, rather than the other way around.

I agree about the concepts part. Also, now that I'm thinking about, remote.html could actually be called api-endpoint.html, that should help, too.

@adamziel
Copy link
Collaborator Author

adamziel commented May 9, 2023

Let's also document debugging Asyncify issues

@jomarieminney
Copy link

  • I think in the getting started section, a bit of a clarification on what the user interface aspect of playground can/can't do - i.e. limitations (you gave an excellent summary of these in Slack somewhere but I've already lost it). For example, the playground is already linked to in multiple locations in learning content, and users who come across it might not be full stack developers but rather (for example) learning how to create a theme using FSE. This is literally the case in which I discovered it and went down the rabbit hole!
    • e.g. you can't access the repo inside a demo (but you can run demo with plugins/specific theme installed, using parameters)
    • The demo is a great place to test out how a block works, without having to spin up a new site or log in and test on a live site.
    • When you refresh the page, you'll lose anything you did (unless you export it)
    • How to export it!

@adamziel
Copy link
Collaborator Author

adamziel commented May 18, 2023

This is such a fantastic feedback @jomarieminney! +1 on everything you said. It would be super cool if the plugins/themes directory inside wp-admin told you "oops, this doesn't work here, but here's how you can install plugins instead:".

adamziel added a commit that referenced this issue May 21, 2023
Solves #323, related to #217.

# Description

This commit revisits the documentation site. Here's a preview:

https://wordpress.github.io/wordpress-playground/docs/blueprints-api/steps/

(I went ahead and deployed it to github.io even tough this PR isn't
merged yet since it's a much better entry point to the project).

## What changed?

This PR:

* Adds the missing bits of the documentation and improve the structure
* Adds the first interactive examples with more to come
* Generates parts of the docs directly from the doc strings
* Adds link validation
* Improves readability and interconnectedness between the content pages
and the API reference

It is the first step towards addressing the following issues with the
current documentation:

* It is incomplete
* It is not interactive
* It is not connected to code and a PR can make it go stale
* It is not testable and there's no way to know whether the code
snippets still work
* API docs can be hard to read
* Dead links – no link validation

## Technical details

* Docusaurus uses [MDX](https://mdxjs.com/) which is essentially
Markdown + React.
* TypeScript documentation is generated with Typedoc and included using
a Docusaurus plugin.
* Repeatable code snippets are abstracted to fragments. Updating them
once updates all the occurrences in the docs.
* We can use React components inside the mdx files. Super useful for
code examples and auto-displaying information derived from the
TypeScript code.

A few practical example of what's so good about this approach

### API Reference integration

<img width="600" alt="CleanShot 2023-05-21 at 14 07 17@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/9a755d3c-e205-4b75-b3c4-bb0cd2bcd131">

### Runnable code examples

<img width="530" alt="CleanShot 2023-05-21 at 14 03 57@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/466bb639-1bda-4303-9ce6-6a05eb234cab">
<img width="530" alt="CleanShot 2023-05-21 at 14 03 50@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/c74916b3-0890-437e-beab-87b60b480fab">

### Reusable content

<img width="400" alt="CleanShot 2023-05-21 at 14 06 38@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/78b3b7b1-042d-46c7-bfa4-c87f2f115d2e">
<img width="400" alt="CleanShot 2023-05-21 at 14 06 14@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/b15d3238-5bca-47e1-bc2e-7ff31a58acc7">

### Inline TOC

<img width="300" alt="CleanShot 2023-05-21 at 14 05 14@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/42a10f13-4f54-4a2c-bb5a-d9a66db85333">
<img width="300" alt="CleanShot 2023-05-21 at 14 05 35@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/e5e374c7-d790-4c89-beb0-f064ccb8588c">

### Deriving Blueprint steps from code

With this PR, adding a Blueprint step into the codebase will
automatically add it to the docs. If it has a usage example, it will be
rendered as a live code snippet. In the future, it will be editable and
the CI will verify whether it still works.

<img width="441" alt="CleanShot 2023-05-21 at 01 23 22@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/80b265f9-6954-45a1-bd35-e888fe3e5f91">

### Docusaurus prevents broken links

<img width="450" alt="CleanShot 2023-05-21 at 00 58 36@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/b5e57360-9f2d-4676-9888-557c4c0bcf0c">

### TypeScript comment embedded inside of a documentation page

<img width="343" alt="CleanShot 2023-05-21 at 01 41 58@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/c4cf1811-549e-4d21-ae8a-3009f8024b5a">

<img width="445" alt="CleanShot 2023-05-21 at 01 42 24@2x"
src="https://github.com/WordPress/wordpress-playground/assets/205419/5d6a9d5b-1286-466b-a082-fcdcc5659439">
@sagargurnani99
Copy link
Contributor

I believe, in the "Getting started" section; it would be helpful to include a brief overview of what WordPress Playground is and its main features before diving into the sales pitch. Where and why to use it.

@adamziel
Copy link
Collaborator Author

Sounds lovely @sagargurnani99! Would you be interested in drafting it up?

@sagargurnani99
Copy link
Contributor

Of course @adamziel.

@adamziel
Copy link
Collaborator Author

adamziel commented Jun 2, 2023

The new documentation site answers many of the questions discussed in this issue, and I created a number of follow-up issues to track anything that's not yet covered:

https://github.com/WordPress/wordpress-playground/issues?q=label%3ADocumentation+is%3Aissue

If anything in that doc is unclear, confusing, missing, or could be improved in any other way – you are the most welcome to start a new issue or a Pull Request to improve it!

cc @johnhooks – I hope the Blueprints doc is clearer now that it lists all the steps. The specific descriptions could be better for sure, but is the overall structure what you hoped for?

@adamziel adamziel closed this as completed Jun 2, 2023
@johnhooks
Copy link

@adamziel looks awesome, I will give it a through read through and I will make sure to file an issue if I run into anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants