Skip to content

Commit 60ba489

Browse files
committed
Merge branch 'master' of https://github.com/mtoensing/simpletoc
2 parents 5f31bf4 + 5870d9b commit 60ba489

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

plugin.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,23 @@ function filter_headings_recursive($blocks)
313313
}
314314
}
315315

316-
if (isset($blocks['blockName']) && ($blocks['blockName'] === 'generateblocks/headline') && $innerBlock !== 'core/heading') {
316+
$supported_third_party_blocks = array(
317+
'generateblocks/headline', /* GenerateBlocks 1.x */
318+
'generateblocks/text', /* GenerateBlocks 2.0 */
319+
);
320+
321+
/**
322+
* Filter to add supported third party blocks.
323+
*
324+
* @param array $supported_third_party_blocks The array of supported third party blocks.
325+
* @return array The modified array of supported third party blocks.
326+
*/
327+
$supported_third_party_blocks = apply_filters(
328+
'simpletoc_supported_third_party_blocks',
329+
$supported_third_party_blocks
330+
);
331+
332+
if (isset($blocks['blockName']) && in_array($blocks['blockName'], $supported_third_party_blocks) && $innerBlock !== 'core/heading') {
317333
// make sure it's a headline.
318334
if (preg_match("/(<h1|<h2|<h3|<h4|<h5|<h6)/i", $innerBlock)) {
319335
$arr[] = $innerBlock;

0 commit comments

Comments
 (0)