File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2362,6 +2362,17 @@ function render_block( $parsed_block ) {
23622362/**
23632363 * Parses blocks out of a content string.
23642364 *
2365+ * Given an HTML document, this function fully-parses block content, producing
2366+ * a tree of blocks and their contents, as well as top-level non-block content,
2367+ * which will appear as a block with no `blockName`.
2368+ *
2369+ * This function can be memory heavy for certain documents, particularly those
2370+ * with deeply-nested blocks or blocks with extensive attribute values. Further,
2371+ * this function must parse an entire document in one atomic operation.
2372+ *
2373+ * If the entire parsed document is not necessary, consider using {@see WP_Block_Scanner}
2374+ * instead, as it provides a streaming and low-overhead interface for finding blocks.
2375+ *
23652376 * @since 5.0.0
23662377 *
23672378 * @param string $content Post content.
Original file line number Diff line number Diff line change 1515 *
1616 * For usage, jump straight to {@see self::next_delimiter}.
1717 *
18+ * If it’s necessary to end up with a fully-parsed document anyway,
19+ * consider using {@see parse_blocks()} instead.
20+ *
1821 * @todo Add wildcard matching to namespace and name in ::opens_block(), ::is_block_type, etc…
1922 * @todo Is "freeform" the best name since it can also appear inside blocks? Maybe "html" or "text" or "non-block content".
2023 * @todo Add optimized lookup for blocks of a known name
You can’t perform that action at this time.
0 commit comments