Discussion: Next Steps for Block Creation Documentation #22151
Description
Context
The Block Directory was first announced just over a year ago and has the eventual aim of enabling users to install single block plugins directly from Gutenberg while editing! This direct installing feature will be a huge step in the right direction for unlocking the power of the Gutenberg editor. Need a block to set up payments? Install and set it up without leaving the editor. Right now though, the process of creating blocks for developers is confusing and has some accidental gaps.
This is where this issue comes in and where your help is needed! What gaps do you see in the current documentation? What do you think about the following overall headers and tasks? Let’s make it easier for developers to create blocks for users to play with in the future by gathering next steps for block creation documentation and diving in.
Consolidate Instructions and Crosslink
The ultimate goal here is a canonical information source for block developers who wish to contribute blocks to the directory. To accomplish this, there needs to be both the creation of and clear differentiation between official documentation vs tutorials as @zzap notes.
- Create new sections in the handbook for a “Creating Blocks” tutorial and "About Blocks" as official documentation. Right now, we just direct folks to the tutorial without further context and there needs to be separate sections depending on the audience. Docs: Create a Block tutorial #22831
- Repurpose the Block Tutorial and Gutenberg workshop materials from @mkaz as the basis for the “Creating Blocks” tutorial. Docs: Create a Block tutorial #22831
- Make the link to the new “Creating Blocks” section more prominent within Gutenberg’s readme. This could include having similar bullet points like the “Using Gutenberg” section has. Docs: Add links for Create a Block Tutorial #23946
- Add a notice on the main Block Editor Handbook page linking to the new “Creating Blocks” tutorial to immediately help folks know where to go to get started. Docs: Add links for Create a Block Tutorial #23946
- Define more clearly what’s allowed for blocks (prior discussion) and include the outcome in the "Creating block" tutorial. Documentation: Add block submission guidelines. #23545
- Document the process for getting a single block plugin uploaded to the block directory as part of the creating a block tutorial. Documentation: Add block submission guidelines. #23545
- Reference Single Block plugins in the Introduction to Plugin Development handbook.
- Restructure the block registration docs in the developer handbook to be easier to follow Consider restructuring Block Registration docs in handbook #20161
- Consolidate information about blocks and the block directory to make up official documentation separate from the tutorial.
Overall, this area of improvements touches on this proposal as well: #18680
Make the First Step Magical
Great developer documentation often has a magical first step that enables someone to have a quick win early in the exploration process. Right now, this quick win is hidden from those trying to create new blocks.
-
Incorporate @wordpress/create-block more clearly into the block tutorial. Docs: Create a Block tutorial #22831
-
Remove WP-CLI references from the block tutorial. Docs: Add links for Create a Block Tutorial #23946
-
Clarify block.json (and perhaps autogenerate it Create Block: Generate a block.json file #23399
-
Break apart the gutenberg-examples repo into different repos to provide a “clone and go” option for new block developers. When doing this, make sure to recreate using @wordpress/create-block for consistency and to list examples focusing on ESNext versions as the default.
-
Add links to React docs where it’s considered that React docs should be consulted. This will likely take the form of a technical audit.
-
Clarify that for block registration, the parent can be empty: Documentation: Clarify the behavior of parent when empty during block registration #15731
Since we require this file for block registration, this proves to be a hurdle for folks to cross in creation of new blocks that can appear in the block directory. As a result, we should focus specifically on improving the official documentation around this particular file.
- Create varied examples of proper block.json.
- Incorporate ESLint rule work to make writing block.json less error prone.
- Explain the “why” behind needing this file in the documentation and what purpose it’ll serve in the overall block directory.
- Reference register_block_type_from_metadata function which is used to register blocks using block.json. Note: there is some work remaining on this function, namely that it does not handle i18n and right now is only in the Gutenberg plugin.
- Make sure all examples in gutenberg-examples repo include a block.json if required.
Please share in the comments anything that’s missing. Teamwork makes the dream work and this is meant to be a jumping off point for dialogue and task assignment.
Big thanks to @mkaz for working on this with me 💥
Activity