Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Docs: Auto-generate human-readable version of Gutenberg block grammar #6116
Related: #6030, as another effort to make the Gutenberg block grammar parser-agnostic.
I'm opening this PR to get the idea out, and so we can iterate on presentation. GitHub's flavor of Markdown doesn't like
wow! this is really developed-out, isn't it!
we also have a parser for the grammar already built, and I'm curious why the changes are made to the grammar in this PR, which seems like it's conflating a few issues.
const parser = require( './node_modules/pegjs/lib/parser.js' ); const fs = require( 'fs' ) const grammarSource = fs.readFileSync( './blocks/api/post.pegjs', 'utf8' ); const grammar = parser.parse( grammarSource );
with these four lines we get a full AST of the grammar which we can use to provide an alternate pretty-printer and I don't think that will involve as much code to maintain
Thanks for looking so quickly!
:) Not really, but bash-assisted gluing helps me to prototype more quickly.
True, but we are to assume that to be part of the public interface of the
That said, the whole diff is telling of my path as I was learning the bits (at some point I was consuming
I'd seen that, and it's pretty cool, but I'm not currently convinced those visualizations would be useful.
For now it seems solid enough. That project will always need to parse the
That's fair, although it covers most of what we spoke about. The point was that we can parse the