Syntax_Highlighter::shortcode( array $atts, string $content = '' )
Description #
Render shortcode [apcode].
Parameters #
- $attsarray (Required) Attributes.
- $contentstring (Optional) Content. Default value: ''
Source #
File: addons/syntaxhighlighter/syntaxhighlighter.php
public function shortcode( $atts, $content = '' ) {
$atts = wp_parse_args(
$atts,
array(
'language' => 'plain',
'inline' => false,
)
);
$tag = $atts['inline'] ? 'code' : 'pre';
$content = preg_replace( '/<br(\s+)?\/?>/i', '', $content );
$klass = 'class="brush: ' . esc_attr( $atts['language'] ) . '"';
$content = str_replace( array( '<pre', '<code' ), array( '<pre ' . $klass, '<code ' . $klass ), $content );
return $content;
}
Expand full source code Collapse full source code View on GitHub: addons/syntaxhighlighter/syntaxhighlighter.php:182
Add your comment