From 5635329d5f093877eb7c65751255924c81b4cc80 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:09:54 -0500 Subject: [PATCH 01/16] Bumping version. --- syntax-highlighting-code-block.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax-highlighting-code-block.php b/syntax-highlighting-code-block.php index 9a60f85b..c877780c 100644 --- a/syntax-highlighting-code-block.php +++ b/syntax-highlighting-code-block.php @@ -3,7 +3,7 @@ * Plugin Name: Syntax-highlighting Code Block (with Server-side Rendering) * Plugin URI: https://github.com/westonruter/syntax-highlighting-code-block * Description: Extending the Code block with syntax highlighting rendered on the server, thus being AMP-compatible and having faster frontend performance. - * Version: 1.4.0 + * Version: 1.4.1 * Author: Weston Ruter * Author URI: https://weston.ruter.net/ * License: GPL2 @@ -16,7 +16,7 @@ namespace Syntax_Highlighting_Code_Block; -const PLUGIN_VERSION = '1.4.0'; +const PLUGIN_VERSION = '1.4.1'; const PLUGIN_MAIN_FILE = __FILE__; From 92f2a9c9ea9d05057377223747e289900799f47a Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:12:19 -0500 Subject: [PATCH 02/16] New Action: syntax_highlighting_code_block_boot - run at plugin boot New Action: `syntax_highlighting_code_block_boot`. This action is run post boot after the `plugins_loaded` action has been executed. This is useful for letting others know when the plugin has finished its boot process in order to modify any early actions and filters the plugin uses. --- inc/functions.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inc/functions.php b/inc/functions.php index 06df308c..74140e5b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -33,6 +33,13 @@ function boot(): void { add_action( 'init', __NAMESPACE__ . '\init', 100 ); add_action( 'customize_register', __NAMESPACE__ . '\customize_register', 100 ); add_action( 'rest_api_init', __NAMESPACE__ . '\register_rest_endpoint' ); + + /** + * Action fired after the plugin has been bootstrapped. + * + * @since 1.4.1 + */ + do_action( 'syntax_highlighting_code_block_boot' ); } /** From 5c1869b1a5e3d279b0b831a02d796fad1c8c7de3 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:15:08 -0500 Subject: [PATCH 03/16] Action: syntax_highlighting_code_block_boot docs update. --- inc/functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/functions.php b/inc/functions.php index 74140e5b..1d33d479 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -37,6 +37,10 @@ function boot(): void { /** * Action fired after the plugin has been bootstrapped. * + * This action is fired immediately after the `plugins_loaded` action is completed. + * Use this action to hook in early knowing the plugin's actions and filters have + * been registered. + * * @since 1.4.1 */ do_action( 'syntax_highlighting_code_block_boot' ); From d1a63ed8eb4431968c92d7ac351d749b98f028be Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:35:36 -0500 Subject: [PATCH 04/16] New Filters: syntax_highlighting_code_block_transient_key and syntax_highlighting_code_block_injected_markup New filter: `syntax_highlighting_code_block_transient_key` - This is for filtering the language param that's returned. See: https://github.com/westonruter/syntax-highlighting-code-block/issues/191 New filter: `syntax_highlighting_code_block_injected_markup` - This is for being able to modify the output before its returned. This is to help those who want to extend the markup or introduce their own. --- inc/functions.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 1d33d479..31b183c1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -656,6 +656,18 @@ function render_block( array $attributes, string $content ): string { // Use the previously-highlighted content if cached. $transient_key = ! DEVELOPMENT_MODE ? get_transient_key( $matches['content'], $attributes, is_feed(), $auto_detect_languages ) : null; + + /** + * Filters the transient key used to cache the highlighted content. + * + * @param string|null $transient_key Transient key. + * @param array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. + * + * @since 1.4.1 + */ + $transient_key = apply_filters( 'syntax_highlighting_code_block_transient_key', $transient_key, $attributes ); + + $highlighted = $transient_key ? get_transient( $transient_key ) : null; if ( is_array( $highlighted ) @@ -672,7 +684,21 @@ function render_block( array $attributes, string $content ): string { && isset( $highlighted['attributes']['wrapLines'] ) && is_bool( $highlighted['attributes']['wrapLines'] ) ) { - return inject_markup( $matches['pre_start_tag'], $matches['code_start_tag'], $highlighted['attributes'], $highlighted['content'] ); + // Get injected markup, set up for filter. + $injected_markup = inject_markup( $matches['pre_start_tag'], $matches['code_start_tag'], $highlighted['attributes'], $highlighted['content'] ); + + /** + * Filter the injected markup before it's returned. + * + * @param string $injected_markup Injected markup. + * @param array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. + * @param string $content Block's original content. + * + * @since 1.4.1 + */ + $injected_markup = apply_filters( 'syntax_highlighting_code_block_injected_markup', $injected_markup, $attributes, $content ); + + return $injected_markup; } try { From 6fe675e9533125cbbe842404d381d315dadc001b Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:39:51 -0500 Subject: [PATCH 05/16] New action: syntax_highlighting_code_block_highlighter_init New action: `syntax_highlighting_code_block_highlighter_init` - Fires in the `render_block` function after the highlighter has been initialized. Helps fix: https://github.com/westonruter/syntax-highlighting-code-block/issues/191 --- inc/functions.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inc/functions.php b/inc/functions.php index 31b183c1..188bf786 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -716,6 +716,15 @@ function render_block( array $attributes, string $content ): string { $highlighter->setAutodetectLanguages( $auto_detect_languages ); } + /** + * Fires after the highlighter is initialized. + * + * @param \Highlight\Highlighter $highlighter Highlighter. + * @param array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. + * @param string $content Block's original content. + */ + do_action( 'syntax_highlighting_code_block_highlighter_init', $highlighter, $attributes, $content ); + $language = $attributes['language']; // Note that the decoding here is reversed later in the escape() function. From 67a966cd6f7fe729e6dd2de58d17b8e2d6f7ff4a Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:44:31 -0500 Subject: [PATCH 06/16] New filter: syntax_highlighting_code_block_language_names - Change language names. Filter: `syntax_highlighting_code_block_language_names` - Resolves issue: https://github.com/westonruter/syntax-highlighting-code-block/issues/488 --- inc/functions.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 188bf786..b95f0b17 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -466,7 +466,16 @@ function get_styles( array $attributes ): string { * @return array Mapping slug to name. */ function get_language_names(): array { - return require PLUGIN_DIR . '/language-names.php'; + $language_names = require PLUGIN_DIR . '/language-names.php'; + + /** + * Filters the list of language names. + * + * @param array $language_names Mapping slug to name. + * + * @since 1.4.1 + */ + return apply_filters( 'syntax_highlighting_code_block_language_names', $language_names ); } /** From d4685f8cd8a544ca4d5469177f17c6768fb46565 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:49:23 -0500 Subject: [PATCH 07/16] Filter: syntax_highlighting_code_block_injected_markup - added to output Filter `syntax_highlighting_code_block_injected_markup` is added to the output for the highlighted portion. --- inc/functions.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index b95f0b17..e8ab381f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -731,6 +731,8 @@ function render_block( array $attributes, string $content ): string { * @param \Highlight\Highlighter $highlighter Highlighter. * @param array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. * @param string $content Block's original content. + * + * @since 1.4.1 */ do_action( 'syntax_highlighting_code_block_highlighter_init', $highlighter, $attributes, $content ); @@ -776,7 +778,17 @@ function render_block( array $attributes, string $content ): string { set_transient( $transient_key, compact( 'content', 'attributes' ), MONTH_IN_SECONDS ); } - return inject_markup( $matches['pre_start_tag'], $matches['code_start_tag'], $attributes, $content ); + // Retrieve injected markup. + $injected_markup = inject_markup( $matches['pre_start_tag'], $matches['code_start_tag'], $attributes, $content ); + + /** + * Filter the injected markup before it's returned. + * + * @see filter definition above. + * + * @since 1.4.1 + */ + return apply_filters( 'syntax_highlighting_code_block_injected_markup', $injected_markup, $attributes, $content ); } catch ( Exception $e ) { return sprintf( '%s', From da323937b7e648ccde34e475ca60681cf21e916e Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:59:15 -0500 Subject: [PATCH 08/16] Adding `highlighted` to filters. --- inc/functions.php | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index e8ab381f..65d17ca1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -676,8 +676,22 @@ function render_block( array $attributes, string $content ): string { */ $transient_key = apply_filters( 'syntax_highlighting_code_block_transient_key', $transient_key, $attributes ); - $highlighted = $transient_key ? get_transient( $transient_key ) : null; + + /** + * Action for when the block is being rendered. + * + * @param null|array $highlighted { + * Previously highlighted content. + * + * @type string $content The block's highlighted/parsed content. + * @type array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. + * } + */ + do_action( 'syntax_highlighting_code_block_render', $highlighted, $attributes, $content, $highlighted ); + + + if ( is_array( $highlighted ) && @@ -702,10 +716,16 @@ function render_block( array $attributes, string $content ): string { * @param string $injected_markup Injected markup. * @param array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. * @param string $content Block's original content. + * @param null|array $highlighted { + * Previously highlighted content. + * + * @type string $content The block's highlighted/parsed content. + * @type array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. + * } * * @since 1.4.1 */ - $injected_markup = apply_filters( 'syntax_highlighting_code_block_injected_markup', $injected_markup, $attributes, $content ); + $injected_markup = apply_filters( 'syntax_highlighting_code_block_injected_markup', $injected_markup, $attributes, $content, $highlighted ); return $injected_markup; } @@ -774,8 +794,11 @@ function render_block( array $attributes, string $content ): string { } } + // Get highlighted for storage and filters. + $highlighted = compact( 'content', 'attributes' ); + if ( $transient_key ) { - set_transient( $transient_key, compact( 'content', 'attributes' ), MONTH_IN_SECONDS ); + set_transient( $transient_key, $highlighted, MONTH_IN_SECONDS ); } // Retrieve injected markup. @@ -784,11 +807,11 @@ function render_block( array $attributes, string $content ): string { /** * Filter the injected markup before it's returned. * - * @see filter definition above. + * @see `syntax_highlighting_code_block_injected_markup` filter definition. * * @since 1.4.1 */ - return apply_filters( 'syntax_highlighting_code_block_injected_markup', $injected_markup, $attributes, $content ); + return apply_filters( 'syntax_highlighting_code_block_injected_markup', $injected_markup, $attributes, $content, $highlighted ); } catch ( Exception $e ) { return sprintf( '%s', From 5907006ed5c07fed7894dd8131d920fef388e676 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 22:59:57 -0500 Subject: [PATCH 09/16] Some code cleanup. --- inc/functions.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 65d17ca1..526ad23a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -675,7 +675,6 @@ function render_block( array $attributes, string $content ): string { * @since 1.4.1 */ $transient_key = apply_filters( 'syntax_highlighting_code_block_transient_key', $transient_key, $attributes ); - $highlighted = $transient_key ? get_transient( $transient_key ) : null; /** @@ -690,8 +689,6 @@ function render_block( array $attributes, string $content ): string { */ do_action( 'syntax_highlighting_code_block_render', $highlighted, $attributes, $content, $highlighted ); - - if ( is_array( $highlighted ) && From cfc638ebac5c48f3c268ae15885483b6594161ee Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Fri, 6 Oct 2023 23:14:37 -0500 Subject: [PATCH 10/16] JS Filter: syntaxHighlightingCodeBlockAttributes Set default attributes. Filter: `syntaxHighlightingCodeBlockAttributes` allows you to set defaults for the code block. --- src/index.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index dd7ee215..c8f7f656 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,9 @@ /** * WordPress dependencies */ -import { addFilter } from '@wordpress/hooks'; +import { addFilter, createHooks, applyFilters } from '@wordpress/hooks'; + +const codeBlockHooks = createHooks(); /** * Internal dependencies @@ -21,6 +23,11 @@ const extendCodeBlockWithSyntaxHighlighting = (settings) => { return settings; } + const mergedAttributes = { + ...settings.attributes, + ...syntaxHighlightingCodeBlockType.attributes, // @todo Why can't this be supplied via a blocks.getBlockAttributes filter? + }; + return { ...settings, @@ -29,10 +36,20 @@ const extendCodeBlockWithSyntaxHighlighting = (settings) => { * There seems to be a race condition, as wp.blocks.getBlockType('core/code') returns the PHP-augmented data after the * page loads, but at the moment this filter calls it is still undefined. */ - attributes: { - ...settings.attributes, - ...syntaxHighlightingCodeBlockType.attributes, // @todo Why can't this be supplied via a blocks.getBlockAttributes filter? - }, + /** + * Filter for block attributes. Useful for setting custom defaults. + * + * @since 1.4.1 + * + * @param {Object} attributes Block attributes. + * @return {Object} Modified attributes. + */ + attributes: applyFilters( + 'syntaxHighlightingCodeBlockAttributes', + mergedAttributes, + settings.attributes, + syntaxHighlightingCodeBlockType.attributes, // @todo Why can't this be supplied via a blocks.getBlockAttributes filter? + ), edit, From 3f0d9eac2535eefe1c5453823c4efe37d3f86b8b Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 7 Oct 2023 05:33:33 -0500 Subject: [PATCH 11/16] New filter: syntax_highlighting_code_block_pre_start_tag Filter `syntax_highlighting_code_block_pre_start_tag` is for adding markup to pre tag and honoring block alignment. --- inc/functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/inc/functions.php b/inc/functions.php index 526ad23a..3aed4b3f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -557,6 +557,18 @@ function inject_markup( string $pre_start_tag, string $code_start_tag, array $at ), $pre_start_tag ); + + /** + * Filter the start tag. + * + * @param string $pre_start_tag The `
` start tag.
+		 * @param string $element_id    The ID of the element containing the language info.
+		 * @param string $language_name The name of the language.
+		 * @param string $language_slug The slug of the language.
+		 *
+		 * @since 1.4.1
+		 */
+		$pre_start_tag = apply_filters( 'syntax_highlighting_code_block_pre_start_tag', $pre_start_tag, $element_id, $language_name, $attributes['language'] );
 	}
 	$end_tags .= '
'; From 4d234556048dddad06b187d7687b4cde6b663a84 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 7 Oct 2023 11:36:18 -0500 Subject: [PATCH 12/16] Filter: syntax_highlighting_code_block_code_classes Add classes. Filter `syntax_highlighting_code_block_code_classes` allows you to add custom classes to the `code` element. --- inc/functions.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 3aed4b3f..d9447c48 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -493,28 +493,38 @@ function get_language_names(): array { * @return string Injected markup. */ function inject_markup( string $pre_start_tag, string $code_start_tag, array $attributes, string $content ): string { - $added_classes = 'hljs'; + $added_classes = array( 'hljs' ); if ( $attributes['language'] ) { - $added_classes .= " language-{$attributes['language']}"; + $added_classes[] = " language-{$attributes['language']}"; } if ( $attributes['showLineNumbers'] || $attributes['highlightedLines'] ) { - $added_classes .= ' shcb-code-table'; + $added_classes[] = 'shcb-code-table'; } if ( $attributes['showLineNumbers'] ) { - $added_classes .= ' shcb-line-numbers'; + $added_classes[] = 'shcb-line-numbers'; } if ( $attributes['wrapLines'] ) { - $added_classes .= ' shcb-wrap-lines'; + $added_classes[] = 'shcb-wrap-lines'; } + /** + * Filters the classes added to the `` element. + * + * @param array $added_classes Index array of CSS classes to add. + * @param array $attributes Block attributes. + * + * @since 1.4.1 + */ + $added_classes = apply_filters( 'syntax_highlighting_code_block_code_classes', $added_classes, $attributes ); + // @todo Update this to use WP_HTML_Tag_Processor. $code_start_tag = (string) preg_replace( '/(]*\sclass=")/', - '$1' . esc_attr( $added_classes ) . ' ', + '$1' . esc_attr( implode( ' ', $added_classes ) ) . ' ', $code_start_tag, 1, $count @@ -522,7 +532,7 @@ function inject_markup( string $pre_start_tag, string $code_start_tag, array $at if ( 0 === $count ) { $code_start_tag = (string) preg_replace( '/(?<=` start tag. * @param string $element_id The ID of the element containing the language info. From 6b9af78fbc982d4608695ef8d5c278fad30092c7 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 7 Oct 2023 11:53:01 -0500 Subject: [PATCH 13/16] Some formatting. --- inc/functions.php | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index d9447c48..b6e44cbc 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -556,14 +556,40 @@ function inject_markup( string $pre_start_tag, string $code_start_tag, array $at esc_html( $attributes['language'] ) ); - // Also include the language in data attributes on the root
 element for maximum styling flexibility.
+		/**
+		 * Add the language info to markup with ARIA attributes. Filterable.
+		 */
+		$tag_attributes = array(
+			'aria-describedby'        => $element_id,
+			'data-shcb-language-name' => $language_name,
+			'data-shcb-language-slug' => $attributes['language'],
+		);
+
+		/**
+		 * Filter the attributes added to the `
` element.
+		 *
+		 * @param array $tag_attributes Associative array of attributes.
+		 * @param array $attributes     Block attributes.
+		 *
+		 * @since 1.4.1
+		 */
+		$tag_attributes = apply_filters( 'syntax_highlighting_code_block_start_tag_attributes', $tag_attributes, $attributes );
+
+		// Format the attributes for the start tag and build start tag.
 		$pre_start_tag = str_replace(
 			'>',
 			sprintf(
-				' aria-describedby="%s" data-shcb-language-name="%s" data-shcb-language-slug="%s">',
-				esc_attr( $element_id ),
-				esc_attr( $language_name ),
-				esc_attr( $attributes['language'] )
+				' %s>',
+				implode(
+					' ',
+					array_map(
+						function ( $key, $value ) {
+							return sprintf( '%s="%s"', sanitize_title( $key ), esc_attr( $value ) );
+						},
+						array_keys( $tag_attributes ),
+						$tag_attributes
+					)
+				)
 			),
 			$pre_start_tag
 		);
@@ -575,10 +601,11 @@ function inject_markup( string $pre_start_tag, string $code_start_tag, array $at
 		 * @param string $element_id    The ID of the element containing the language info.
 		 * @param string $language_name The name of the language.
 		 * @param string $language_slug The slug of the language.
+		 * @param array  $attributes    Block attributes.
 		 *
 		 * @since 1.4.1
 		 */
-		$pre_start_tag = apply_filters( 'syntax_highlighting_code_block_pre_start_tag', $pre_start_tag, $element_id, $language_name, $attributes['language'] );
+		$pre_start_tag = apply_filters( 'syntax_highlighting_code_block_pre_start_tag', $pre_start_tag, $element_id, $language_name, $attributes['language'], $attributes );
 	}
 	$end_tags .= '
'; From 5437aca83e61c639ac4e9ebcd9922f1907e75b36 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 7 Oct 2023 12:24:56 -0500 Subject: [PATCH 14/16] Removing filter `syntax_highlighting_code_block_pre_start_tag` Remove filter `syntax_highlighting_code_block_pre_start_tag` as pre tag is not designed to have extra markup injected. --- inc/functions.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index b6e44cbc..1855f533 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -593,19 +593,6 @@ function ( $key, $value ) { ), $pre_start_tag ); - - /** - * Filter the start tag. Allow others to insert markup. - * - * @param string $pre_start_tag The `
` start tag.
-		 * @param string $element_id    The ID of the element containing the language info.
-		 * @param string $language_name The name of the language.
-		 * @param string $language_slug The slug of the language.
-		 * @param array  $attributes    Block attributes.
-		 *
-		 * @since 1.4.1
-		 */
-		$pre_start_tag = apply_filters( 'syntax_highlighting_code_block_pre_start_tag', $pre_start_tag, $element_id, $language_name, $attributes['language'], $attributes );
 	}
 	$end_tags .= '
'; From 0ca30ab33e19d20cff7f4772edfc336f0ad29029 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 7 Oct 2023 14:13:11 -0500 Subject: [PATCH 15/16] Adding inc to build as excluding it causes fatals. --- Gruntfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Gruntfile.js b/Gruntfile.js index 0585c74a..f5df58f9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -54,6 +54,7 @@ module.exports = function (grunt) { 'readme.txt', 'LICENSE', 'build/*', + 'inc/*', ]; grunt.config.set('copy', { From ac48a0b0b5e608ff899f0116ddbeaedb2869312c Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Sat, 7 Oct 2023 14:38:50 -0500 Subject: [PATCH 16/16] Doc block cleanup. --- inc/functions.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 1855f533..54c63442 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -716,14 +716,11 @@ function render_block( array $attributes, string $content ): string { /** * Action for when the block is being rendered. * - * @param null|array $highlighted { - * Previously highlighted content. - * - * @type string $content The block's highlighted/parsed content. - * @type array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. - * } + * @param null|array $highlighted + * @param array $attributes Block attributes. See constant ATTRIBUTE_SCHEMA. + * @param string $content Block's original content. */ - do_action( 'syntax_highlighting_code_block_render', $highlighted, $attributes, $content, $highlighted ); + do_action( 'syntax_highlighting_code_block_render', $highlighted, $attributes, $content ); if ( is_array( $highlighted )