Skip to content

Commit

Permalink
New action: syntax_highlighting_code_block_highlighter_init
Browse files Browse the repository at this point in the history
New action: `syntax_highlighting_code_block_highlighter_init` - Fires in the `render_block` function after the highlighter has been initialized. Helps fix: westonruter#191
  • Loading branch information
ronaldhuereca committed Oct 7, 2023
1 parent d1a63ed commit 6fe675e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6fe675e

Please sign in to comment.