From 641c3ca01fda9883d9b1b9b17af325b3d35596c9 Mon Sep 17 00:00:00 2001 From: Renatho De Carli Rosa Date: Mon, 13 Apr 2020 15:58:18 -0300 Subject: [PATCH 1/2] Add parse classname attribute to syntaxhighlighter block --- syntaxhighlighter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/syntaxhighlighter.php b/syntaxhighlighter.php index 667a2b7..59d868b 100644 --- a/syntaxhighlighter.php +++ b/syntaxhighlighter.php @@ -500,6 +500,7 @@ public function enable_brushes_via_raw_html_parsing( $content ) { */ public function render_block( $attributes, $content ) { $remaps = array( + 'className' => 'classname', 'lineNumbers' => 'gutter', 'firstLineNumber' => 'firstline', 'highlightLines' => 'highlight', From 53786a3e2ce5b6b77c5259d39b3dbd49f9f57e1a Mon Sep 17 00:00:00 2001 From: Renatho De Carli Rosa Date: Thu, 23 Apr 2020 18:51:41 -0300 Subject: [PATCH 2/2] Fix when block or shortcode uses more than one css class --- syntaxhighlighter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxhighlighter.php b/syntaxhighlighter.php index 59d868b..d0db9cb 100644 --- a/syntaxhighlighter.php +++ b/syntaxhighlighter.php @@ -1244,7 +1244,7 @@ function shortcode_callback( $atts, $code = '', $tag = false ) { // Sanitize the "classname" parameter if ( 'class-name' == $key ) - $value = trim( preg_replace( '/[^a-zA-Z0-9 _-]/i', '', $value ) ); + $value = "'" . trim( preg_replace( '/[^a-zA-Z0-9 _-]/i', '', $value ) ) . "'"; // Special sanitization for "pad-line-numbers" if ( 'pad-line-numbers' == $key ) {