<?xml version="1.0" encoding="windows-1252"?>
<node id="1007577" title="Re: CSS Show and Tell: Colored Code" created="2012-12-06 09:00:43" updated="2012-12-06 09:00:43">
<type id="11">
note</type>
<author id="757127">
tobyink</author>
<data>
<field name="doctext">
&lt;p&gt;I can beat that. Add the following to your Free Nodelet HTML (see [id://492700])...&lt;/p&gt;
&lt;code&gt;
&lt;script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeEclipse.css" rel="stylesheet" type="text/css" /&gt;
&lt;script type="text/javascript"&gt;
$(function() {
	$('p.code').each(function (i, c) {
		var $code = $(c).find('tt.codetext').text();
		var $dl   = $(c).find('span.embed-code-dl');
		
		var $pre = '&lt;pre class="brush: perl; toolbar: false;"&gt;'
			+ $('&lt;div/&gt;').text($code).html()
			+ '&lt;/pre&gt;';
		
		$(c).after($dl);
		$(c).replaceWith($pre);
	});
	SyntaxHighlighter.all();
});
&lt;/script&gt;
&lt;/code&gt;
&lt;p&gt;Make sure that your Free Nodelet is visible on [id://25185], then... holy crap... syntax highlighting for all code blocks!&lt;/p&gt;
&lt;p&gt;Caveat: it assumes that all code blocks should use &lt;em&gt;Perl&lt;/em&gt; syntax highlighting. Bonus points for anyone crazy enough to attempt content sniffing to determine the correct syntax highlighting style.&lt;/p&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-757127"&gt;
&lt;small&gt;&lt;small&gt;
&lt;tt&gt;perl -E'sub Monkey::do{say$_,for@_,do{($monkey=&amp;#x5B;caller(0)]-&gt;&amp;#x5B;3])=~s{::}{ }and$monkey}}"Monkey say"-&gt;Monkey::do'
&lt;/tt&gt;&lt;/small&gt;&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1007451</field>
<field name="parent_node">
1007451</field>
</data>
</node>
