How to get WordPress Pastcode Plugin to highlight a new language syntax

I have been using this plugin to https://wordpress.org/plugins/pastacode/

highlight some of my programming. I write a bit in Powershell however this is not a supported markup. This is what to add to your functions file of your theme to add another library

/** pastcode plugin */
add_filter( ’pastacode_langs’, ’_pastacode_langs’ );
function _pastacode_langs( $langs ) {
$langs[’powershell’] = ’Powershell’;
return $langs;
}

add_filter( ’pastacode_tinymcevars’, ’_pastacode_tinymcevars’ );
function _pastacode_tinymcevars( $pvars ) {
$pvars[’scripts’][’powershell’]=get_template_directory_uri().’/js/powershell.js’;
$array=array(
’libs’ => array(‘powershell’),
’mode’ => ’application/x-powershell’,
);

$pvars[’language_mode’][’powershell’]=$array;
return $pvars;
}

add_action(‘wp_enqueue_scripts’, ’mytheme_scripts’);

function mytheme_scripts() {
wp_dequeue_script( ’prismjs’ );
wp_deregister_script( ’prismjs’ );
wp_enqueue_script( ’prismjs’, get_template_directory_uri().’/js/prism.js’, false,PASTACODE_VERSION, true );
}

You will also need to create a js folder and upload the new .js library from https://codemirror.net/mode/ and prism.js

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...