
{"id":417,"date":"2008-06-04T10:22:04","date_gmt":"2008-06-04T09:22:04","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=417"},"modified":"2009-01-12T14:52:38","modified_gmt":"2009-01-12T13:52:38","slug":"actionscript-syntax-highlighting","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2008\/06\/04\/actionscript-syntax-highlighting\/","title":{"rendered":"ActionScript syntax highlighting"},"content":{"rendered":"<p>I wanted an easy way to present my ActionScript code on my blog.<\/p>\n<p>The easiest way is to use the <code>code<\/code> button in WordPress and CSS.<br \/>\nI&#8217;ve used this in combination with the pre tag<br \/>\nBut that&#8217;s doesn&#8217;t show nice code <a href=\"http:\/\/en.wikipedia.org\/wiki\/Syntax_highlighting\">highlighting<\/a> or line numbers&#8230;<\/p>\n<blockquote><p>Syntax highlighting is a feature of some text editors that displays text &#8220;especially source code&#8221; in different colors and fonts according to the category of terms.<\/p><\/blockquote>\n<p>I found out that there are two (probably more, but these two are the ones I tested) methods:<br \/>\ncode highlighting <strong>server sided<\/strong> (PHP) or <strong>client sided<\/strong> (javascript)<\/p>\n<h3>Server sided<\/h3>\n<p>The first WordPress highlight plugin is: <a href=\"http:\/\/blog.igeek.info\/still-fresh\/category\/wp-plugins\/igsyntax-hiliter\/\">iG:Syntax Hiliter<\/a> which is based upon <a href=\"http:\/\/qbnz.com\/highlighter\/\">GeSHi<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/as3syntaxhighlight_1.jpg\" alt=\"\" title=\"AS3 syntaxhighlight\" width=\"500\" height=\"203\" class=\"alignnone size-full wp-image-418\" srcset=\"https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/as3syntaxhighlight_1.jpg 519w, https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/as3syntaxhighlight_1-300x121.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<blockquote><p>GeSHi &#8211; Generic Syntax Highlighter for PHP. Used to highlight almost any code for the web. Nearly 100 supported languages: PHP, HTML, C and more. Styles can be changed on the fly and CSS classes can be used to reduce the amount of XHTML compliant output.<\/p><\/blockquote>\n<p>Because the code highlighting is done on the server it&#8217;s really quick.<br \/>\nThe install was very easy and it&#8217;s very easy to use: <code>[as] place your code here [\/as]<\/code> (this is the code you use for ActionScript, read the manual included in the zip for other languages)<\/p>\n<p><strong>Pro:<\/strong> serversided so the code highlighting is done almost at once, a lot of programming languages that can be highlighted, easy to use in WordPress<br \/>\n<strong>Con:<\/strong> extra pressure on the server?, no copy to clipboard, not sure how up-to-date the plugin is (it works very good, but the last post about the plugin is from 2006, although the writer of the plugin replies to recent comments), I&#8217;m not very fond of the default CSS (but that can be modified). no button in the WordPress wysiwyg\/html editor <\/p>\n<h3>Client sided<\/h3>\n<p>The second plugin is: <strike><a href=\"http:\/\/erik.range-it.de\/wordpress\/plugins\/syntaxhighlighter\/\">syntaxhighlighter<\/a> written by Erik Range<\/strike>, this plugin is based upon <a href=\"http:\/\/code.google.com\/p\/syntaxhighlighter\/\">dp.SyntaxHighlighter<\/a> from Alex Gorbatchev.<\/p>\n<div class='highlight'>The plugin that I installed is removed, but there is a new one:<a href=\"http:\/\/wordpress.org\/extend\/plugins\/syntaxhighlighter\/\">http:\/\/wordpress.org\/extend\/plugins\/syntaxhighlighter\/<\/a>. This one is in the WordPress plugin directory, so it&#8217;s easy to install. I haven&#8217;t tested this one\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/as3syntaxhighlight_2-300x75.jpg\" alt=\"syntaxhighlighter\" title=\"AS3 syntaxhighlight\" width=\"300\" height=\"75\" class=\"alignnone size-medium wp-image-419\" srcset=\"https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/as3syntaxhighlight_2-300x75.jpg 300w, https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/as3syntaxhighlight_2.jpg 527w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<blockquote><p>SyntaxHighlighter is here to help a developer\/coder to post code snippets online with ease and have it look pretty. It&#8217;s 100% Java Script based and it doesn&#8217;t care what you have on your server.<\/p><\/blockquote>\n<p>Because the code highlighting is done client sided, you will see some &#8216;flickering&#8217;, and change of appearances of the code block.<br \/>\nDefault the <strong>dp.SyntaxHighlighter<\/strong> doesn&#8217;t include ActionScript so I had to add that to it (<a href=\"http:\/\/www.digitalflipbook.com\/archives\/2007\/09\/as3_syntax_high.php\">digitalflipbook<\/a> wrote the javascript file so I only had to add it), change the WordPress plugin (it didn&#8217;t have ActionScript either ), update the WordPress Plugin to version 1.5.1 of dp.SyntaxHighlighter and fix the copy to clipboard function&#8230;.<\/p>\n<p><strong>Pro:<\/strong> no extra pressure on the server, copy to clipboard, it looks nicer, posible to add just one language instead of all,<br \/>\n<strong>Con:<\/strong> no default ActionScript, view code in popup, no button in the WordPress wysiwyg\/html editor <\/p>\n<h3>My choice<\/h3>\n<p><strike>Both have there strong points and there weaknesses, but I choose <a href=\"http:\/\/blog.igeek.info\/still-fresh\/category\/wp-plugins\/igsyntax-hiliter\/\">iG:Syntax Hiliter<\/a> because of it has included ActionScript default, and the processing of the code highlighting is done on the server side.<\/strike><\/p>\n<div class=\"update\"><strong>Update #1:<\/strong> For some reason iG:Syntax Hiliter changes the < code>-tag to a highlighted code block with the programming language <code>code<\/code> (never heard of that programming language \ud83d\ude09 ) but more strangely: to something unreadable&#8230; I always test all the plugins I want to use on a WordPress blog installed on a usb-webserver and the plugin works fine there, probably the plugins I have installed on my &#8216;live&#8217; blog don&#8217;t play nice with each other. I don&#8217;t have the time to find out who they are, so I used syntaxhighlighter.<br \/>\nThere is no reason you shouldn&#8217;t use iG:Syntax Hiliter: it works fine with WordPress 2.5, it just doesn&#8217;t on my blog. \ud83d\ude41<\/div>\n<p>[as]<br \/>\nfunction test ():void {<br \/>\n      trace (&#8216;test&#8217;);<br \/>\n}<br \/>\n[\/as]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted an easy way to present my ActionScript code on my blog. The easiest way is to use the code button in WordPress and CSS. I&#8217;ve used this in combination with the pre tag But that&#8217;s doesn&#8217;t show nice code highlighting or line numbers&#8230; Syntax highlighting is a feature of some text editors that [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,17],"tags":[68,158,156,157,155,153,406],"class_list":["post-417","post","type-post","status-publish","format-standard","hentry","category-flash","category-wordpress-plugin","tag-actionscript","tag-clipboard","tag-code-snippets","tag-programming-languages","tag-syntax-highlighter","tag-wordpress-25","tag-wordpress-plugin"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=417"}],"version-history":[{"count":3,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/417\/revisions"}],"predecessor-version":[{"id":780,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/417\/revisions\/780"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}