-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parser: Start tokenizing HTML within the blocks
This change adds a behavior which was present in the original parser but removed for some reason when it was pulled directly into Gutenberg. That behavior is producing a tree of tokenized HTML inside the blocks so that we can work with the simpler data structure than having to repeatedly parse and validate HTML strings from within the components and throughout the different paths in the editor. This change adds a new field to the parse output: `children`, which contains the tree as a list of objects, each child being able to reflect the structure of its parent with the same tree data structure. HTML tags appear as `type: HTML_Tag` with `name` equal to the tag name. Otherwise the HTML tags mimick the structure of blocks at the outermost level. Future work will replicate this pattern to add in nested blocks (also in the original parser but removed when it was brought into Gutenberg). Nested blocks would appear in the `children` array and contain full block structure, nested intuitively and without having an exceptional structure or indication.
- Loading branch information
Showing
2 changed files
with
1,362 additions
and
200 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.