Commit c118e38
committed
Blocks: Introduce WP_Block_Scanner for efficiently parsing blocks.
The Block Scanner follows the HTML API in providing a streaming,
near-zero-overhead, lazy, re-entrant parser for traversing block
structure. This class provides an alternate interface to
`parse_blocks()` which is more amenable to a number of common
server-side operations on posts, such as:
- Generating an excerpt from only the first N blocks in a post.
- Determining which block types are present in a post.
- Determining which posts contain a block of a given type.
- Generating block supports content for a post.1 parent 99499d8 commit c118e38
3 files changed
Lines changed: 2403 additions & 0 deletions
File tree
- src
- wp-includes
- tests/phpunit/tests/block-scanner
0 commit comments