Skip to content

Commit

Permalink
Merge pull request #138 from Automattic/fix/classname-through-block
Browse files Browse the repository at this point in the history
Add parse classname attribute to syntaxhighlighter block
renatho authored Apr 24, 2020
2 parents e53ba0c + 53786a3 commit 4e7a6b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion syntaxhighlighter.php
Original file line number Diff line number Diff line change
@@ -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',
@@ -1243,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 ) {

0 comments on commit 4e7a6b7

Please sign in to comment.