diff --git a/.wp-env.json b/.wp-env.json
index a911368a..31b99073 100644
--- a/.wp-env.json
+++ b/.wp-env.json
@@ -1,4 +1,10 @@
{
"core": null,
- "plugins": [ "." ]
+ "plugins": [
+ ".",
+ "https://downloads.wordpress.org/plugin/gutenberg.zip"
+ ],
+ "config": {
+ "WP_DEBUG_LOG": true
+ }
}
diff --git a/inc/functions.php b/inc/functions.php
index 6ef16ffb..2069524d 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -635,9 +635,12 @@ function render_block( array $attributes, string $content ): string {
$language = $attributes['language'];
+ // As of Gutenberg 17.1, line breaks in Code blocks are serialized as
tags whereas previously they were newlines.
+ $content = str_replace( '
', "\n", $matches['content'] );
+
// Note that the decoding here is reversed later in the escape() function.
// @todo Now that Code blocks may have markup (e.g. bolding, italics, and hyperlinks), these need to be removed and then restored after highlighting is completed.
- $content = html_entity_decode( $matches['content'], ENT_QUOTES );
+ $content = html_entity_decode( $content, ENT_QUOTES );
// Convert from Prism.js languages names.
if ( 'clike' === $language ) {