{"id":4620,"date":"2020-05-04T22:23:43","date_gmt":"2020-05-04T22:23:43","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=4620"},"modified":"2022-12-02T03:30:33","modified_gmt":"2022-12-02T03:30:33","slug":"how-to-get-wordpress-pastcode-plugin-to-highlight-a-new-language-syntax","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/random\/how-to-get-wordpress-pastcode-plugin-to-highlight-a-new-language-syntax","title":{"rendered":"How to get WordPress Pastcode Plugin to highlight a new language syntax"},"content":{"rendered":"\n<p>I have been using this plugin to&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/pastacode\/\">https:\/\/wordpress.org\/plugins\/pastacode\/<\/a><\/p>\n\n\n\n<p>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<\/p>\n\n\n<div class=\"wp-block-wab-pastacode\">\n\t<div class=\"code-embed-wrapper\"> <pre class=\"language-markup code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markup code-embed-code\">\/** pastcode plugin *\/<br\/>add_filter( \u2019pastacode_langs\u2019, \u2019_pastacode_langs\u2019 );<br\/>function _pastacode_langs( $langs ) {<br\/>\t$langs[\u2019powershell\u2019] = \u2019Powershell\u2019;<br\/>\treturn $langs;<br\/>}<br\/><br\/>add_filter( \u2019pastacode_tinymcevars\u2019, \u2019_pastacode_tinymcevars\u2019 );<br\/>function _pastacode_tinymcevars( $pvars ) {<br\/>\t$pvars[\u2019scripts\u2019][\u2019powershell\u2019]=get_template_directory_uri().\u2019\/js\/powershell.js\u2019;<br\/>\t$array=array(<br\/>\t\t\t\u2019libs\u2019      =&gt; array(\u2018powershell\u2019),<br\/>\t\t\t\u2019mode\u2019      =&gt; \u2019application\/x-powershell\u2019,<br\/>\t\t\t);<br\/><br\/>\t$pvars[\u2019language_mode\u2019][\u2019powershell\u2019]=$array;<br\/>\treturn $pvars;<br\/>}<br\/><br\/>add_action(\u2018wp_enqueue_scripts\u2019, \u2019mytheme_scripts\u2019);<br\/><br\/>function mytheme_scripts() {<br\/>  wp_dequeue_script( \u2019prismjs\u2019 );<br\/>  wp_deregister_script( \u2019prismjs\u2019 );<br\/>  wp_enqueue_script( \u2019prismjs\u2019,  get_template_directory_uri().\u2019\/js\/prism.js\u2019, false,PASTACODE_VERSION, true );<br\/>} <\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><\/div>\n\n\n\n<p>You will also need to create a\u00a0<strong>js<\/strong>\u00a0folder and upload the new .js library from\u00a0<a href=\"https:\/\/codemirror.net\/mode\/\">https:\/\/codemirror.net\/mode\/<\/a>\u00a0and prism.js<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been using this plugin to&nbsp;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1287,1140,3239,3238,576,3240],"class_list":["post-4620","post","type-post","status-publish","format-standard","hentry","category-random","tag-add","tag-code","tag-language","tag-pastacode","tag-powershell","tag-syntax"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=4620"}],"version-history":[{"count":2,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4620\/revisions"}],"predecessor-version":[{"id":6473,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4620\/revisions\/6473"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=4620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=4620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=4620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}