<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Notes Log &#187; Chili</title>
	<atom:link href="http://noteslog.com/category/chili/feed/" rel="self" type="application/rss+xml" />
	<link>http://noteslog.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 15:11:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Chili NEXT on github</title>
		<link>http://noteslog.com/post/chili-next-on-github/</link>
		<comments>http://noteslog.com/post/chili-next-on-github/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 20:40:34 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=673</guid>
		<description><![CDATA[I&#8217;ve setup a github account for Chili, based on the github account for jQuery. Anyone interested in forging the NEXT version of Chili is warmly welcome. You should be able to join and contribute as easily as possible. I&#8217;m still a bit new to git and github, but I hope I have prepared a usable setup for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve setup a <a href="http://github.com/aercolino/Chili" target="_blank">github account for Chili</a>, based on the <a href="http://github.com/jquery/jquery" target="_blank">github account for jQuery</a>.</p>
<p>Anyone interested in forging the NEXT version of Chili is warmly welcome.</p>
<p>You should be able to join and contribute as easily as possible.</p>
<p>I&#8217;m still a bit new to git and github, but I hope I have prepared a usable setup for development.</p>
<p>The current source, is almost version 2.2, but heavily refactored, simplified and documented.</p>
<p>There are some minor differences, so that it&#8217;s not compatible with version 2.2 anymore.</p>
<p>NEXT version could be 2.3 or 3.0, most likely the latter.</p>
<p>In the github wiki I jotted down a minimal wish list.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/chili-next-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chili 2.2 Released Today</title>
		<link>http://noteslog.com/post/chili-22-released-today/</link>
		<comments>http://noteslog.com/post/chili-22-released-today/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 20:07:58 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=217</guid>
		<description><![CDATA[Changes Added support for local line numbers plain starting from an offset automatically segmented Improved the PHP recipe for defaulting to PHP instead of HTML when no &#60;? is found Links download start page]]></description>
			<content:encoded><![CDATA[<h4>Changes</h4>
<ul>
<li>Added support for local line numbers
<ul>
<li>plain</li>
<li>starting from an offset</li>
<li>automatically segmented</li>
</ul>
</li>
<li>Improved the PHP recipe for defaulting to PHP instead of HTML when no &lt;? is found</li>
</ul>
<h4>Links</h4>
<ul>
<li><a href="http://code.google.com/p/jquery-chili-js/downloads/list">download</a></li>
<li><a href="http://noteslog.com/personal/projects/chili/" target="_blank">start page</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/chili-22-released-today/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chili 2.1 Released Today</title>
		<link>http://noteslog.com/post/chili-21-released-today/</link>
		<comments>http://noteslog.com/post/chili-21-released-today/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 16:39:29 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=215</guid>
		<description><![CDATA[UPDATE: Chili 2.2 has been released Changes Added support for line numbers (boolean option: lineNumbers) Added a selection helper for Internet Explorer and Mozilla Improved the PHP recipe for working fine with Safari too Improved crossbrowser support Links download start page]]></description>
			<content:encoded><![CDATA[<h4><span><span style="color: #ff0000;"><strong>UPDATE</strong>: <a href="http://noteslog.com/post/chili-22-released-today" target="_self">Chili 2.2</a> has been released</span></span></h4>
<h4>Changes</h4>
<ul>
<li>Added support for line numbers (boolean option: lineNumbers)</li>
<li>Added a selection helper for Internet Explorer and Mozilla</li>
<li>Improved the PHP recipe for working fine with Safari too</li>
<li>Improved crossbrowser support</li>
</ul>
<h4>Links</h4>
<ul>
<li><a href="http://code.google.com/p/jquery-chili-js/downloads/list">download</a></li>
<li><a href="http://noteslog.com/personal/projects/chili/" target="_blank">start page</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/chili-21-released-today/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chili 2.0 Released Today</title>
		<link>http://noteslog.com/post/chili-20-released-today/</link>
		<comments>http://noteslog.com/post/chili-20-released-today/#comments</comments>
		<pubDate>Tue, 13 May 2008 21:40:14 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=207</guid>
		<description><![CDATA[UPDATE: Chili 2.1 has been released Changes added support for a much better recipe format optimized regular expressions for speed moved project hosting to Google Code: jquery-chili-js removed support for the previous recipe format removed support for metaobjects removed support for nearly obsolete features Links download start page A new recipe format Chili 2.0 supports [...]]]></description>
			<content:encoded><![CDATA[<h4><span style="color: #ff0000;"><strong>UPDATE</strong>: <a href="http://noteslog.com/post/chili-21-released-today" target="_self">Chili 2.1</a> has been released</span></h4>
<h4>Changes</h4>
<ul>
<li>added support for a much better recipe format</li>
<li>optimized regular expressions for speed</li>
<li>moved project hosting to Google Code: <a href="http://code.google.com/p/jquery-chili-js/" target="_blank">jquery-chili-js</a></li>
<li>removed support for the previous recipe format</li>
<li>removed support for metaobjects</li>
<li>removed support for nearly obsolete features<br />
<a href="http://code.google.com/p/jquery-chili-js/" target="_blank"></a></li>
</ul>
<h4>Links</h4>
<ul>
<li><a href="http://code.google.com/p/jquery-chili-js/downloads/list">download</a></li>
<li><a href="http://noteslog.com/personal/projects/chili/" target="_blank">start page</a></li>
</ul>
<h4>A new recipe format</h4>
<p>Chili 2.0 supports a new recipe format which is a bit more structured than the old one and will make hard-to-highlight languages a thing of the past. BTW, old recipes won&#8217;t be accepted by Chili 2.0. (although a simple manual conversion is possible)</p>
<h5>How to convert old recipes to the new format</h5>
<p>First of all let&#8217;s see an example of how to convert a recipe in the old format to the new one.</p>
<p>What follows is a piece of recipe (for JavaScript) in the old format</p>
<p><pre><code class="javascript">{
	  ignoreCase: false
	, steps: {
		  ml_comment: { 
			exp: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
		}
		, sl_comment: { 
			exp: /\/\/.*/
		}
		//...
	}
}</code></pre></p>
<p>And here is the same piece in the new format</p>
<p><pre><code class="javascript">{
	  _name: 'js'
	, _case: true
	, _main: {
		  ml_comment: { 
			  _match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
			, _style: 'color: gray;'
		}
		, sl_comment: { 
			  _match: /\/\/.*/
			, _style: 'color: green;'
		}
		//...
	}
}</code></pre></p>
<p>As you see, they are very similar. Here are all the differences:</p>
<ol>
<li>property names beginning with an underscore are reserved words</li>
<li><span style="color: #333399;">_name</span> didn&#8217;t exist before</li>
<li><span style="color: #333399;">_case</span> replaces the old <span style="color: #333399;">ignoreCase<span style="color: #000000;">; <span style="color: #333399;">_case</span> is TRUE if the language is case sensitive, and FALSE otherwise; <span style="color: #333399;">_case</span> defaults to FALSE</span></span></li>
<li><span style="color: #333399;"><span style="color: #000000;"><span style="color: #333399;">_main</span> replaces the old <span style="color: #333399;">steps</span></span></span></li>
<li><span style="color: #333399;"><span style="color: #000000;"><span style="color: #333399;"><span style="color: #000000;"><span style="color: #333399;">_match</span> replaces the old <span style="color: #333399;">exp</span></span></span></span></span></li>
<li><span style="color: #333399;"><span style="color: #000000;"><span style="color: #333399;"><span style="color: #000000;"><span style="color: #333399;">_style</span> didn&#8217;t exist before</span></span></span></span></li>
</ol>
<p><span style="color: #333399;">_style</span> makes a big difference with respect to the past: CSS styles can now be embedded into the recipe. Separate stylesheets are no longer supported by the autoloading engine, but you can load them by yourself, if you prefer to keep them apart.</p>
<p>Another important difference about CSS is that now Chili builds the class associated to a step, by prefixing the <span style="color: #333399;">_name</span> to the step name, separated by <span style="color: #333399;">__</span> (a double underscore). So, for example, the class for the multiline comment will be <span style="color: #333399;">js__ml_comment</span>.</p>
<h4>More expressive power with the new recipe format</h4>
<p>Besides the minor changes described in the previous section, the new format is much more powerful thanks to the major improvement I&#8217;m going to describe here.</p>
<p>The old recipe format supported an optional <span style="color: #333399;">replacement</span> property of a step, by means of which you could customize how the highlighting was applied to the matched text. Such a feature was useful when you captured subexpressions and wanted to highlight them separately.</p>
<p><span style="color: #333399;"><span style="color: #000000;">Now </span>_replace</span> replaces <span style="color: #333399;">replacement</span> (sic) and it&#8217;s still optional.</p>
<p>As before, if you don&#8217;t specify a <span style="color: #333399;">_replace</span> property, Chili will default to <span style="color: #333399;">&lt;span class=&#8221;$0&#8243;&gt;$$&lt;/span&gt;</span>, where <span style="color: #333399;">$0</span> and <span style="color: #333399;">$$</span> refer to the name of the current step and the matched text respectively.</p>
<p>As before, <span style="color: #333399;">_replace</span> can also be a different string expression, like in the following step, extracted from the MySQL recipe</p>
<p><pre><code class="javascript">variable: { 
	  _match: /@([$.\w]+|([`\&quot;\'])(?:(?:[^\2\\\r\n]*?(?:\2\2|\\.))*[^\2\\\r\n]*?)\2)/
	, _replace: '&lt;span class=&quot;keyword&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;variable&quot;&gt;$1&lt;/span&gt;'
	, _style: { keyword: 'color: navy;', variable: 'color: blue;' }
}</code></pre></p>
<p>What to note in the above example:</p>
<ol>
<li>you can specify a style for each of the involved classes, by using properties of an object</li>
<li>you must use a span for applying style to a text run</li>
</ol>
<h5>A big improvement</h5>
<p>In Chili 2.0, <strong><span style="color: #333399;">_replace</span> can also be a function</strong>, like in the following step, extracted from the new HTML recipe</p>
<p><pre><code class="javascript">// matches a starting tag of an element (with attrs)
// like &quot;&lt;div ... &gt;&quot; or &quot;&lt;img ... /&gt;&quot;
, tag_start: { 
	  _match: /(&lt;\w+)((?:\w|[?%]&gt;|\W)*?)(\/&gt;|&gt;)/ 
	, _replace: function( all, open, content, close ) { 
		  return &quot;&lt;span class='tag_start'&gt;&quot; + this.x( open ) + &quot;&lt;/span&gt;&quot; 
			  + this.x( content, '/tag_attrs' ) 
			  + &quot;&lt;span class='tag_start'&gt;&quot; + this.x( close ) + &quot;&lt;/span&gt;&quot;;
	}
	, _style: &quot;color: navy; font-weight: bold;&quot;
}</code></pre></p>
<p>What to note in the above example:</p>
<ol>
<li><span style="color: #333399;"><span style="color: #000000;">when </span>_replace</span> is a function, it receives match and submatches as arguments, and inside</li>
<li>there is a valid <span style="color: #333399;">this</span> object which contains a magic <span style="color: #333399;">x</span> method, by which</li>
<li>a string can be escaped for HTML (like <span style="color: #333399;">open</span> and <span style="color: #333399;">close</span>), or</li>
<li>a string can be transformed by an expression (like <span style="color: #333399;">content</span>)</li>
</ol>
<h4>Chili 2.0 recipes are modular</h4>
<p>A Chili 2.0 recipe contains blocks (like <span style="color: #333399;">_main</span>), which contain steps (like <span style="color: #333399;">tag_start</span>). An expression can be built for referencing each module, be it a recipe, a block, or a step. For example, <span style="color: #333399;">/tag_attrs</span> is the <span style="color: #333399;">tag_attrs</span> block in the current recipe.</p>
<h5>One method to highlight them all</h5>
<p>The JavaScript code inside a <span style="color: #333399;">_replace</span> function can use the <span style="color: #333399;">x</span> method of <span style="color: #333399;">this</span>.</p>
<p><span style="color: #333399;">x</span> takes two arguments: a subject to process, and an optional module to use.</p>
<p><span style="color: #333399;">x</span> returns the subject escaped for HTML if no module is given, or the module is not available, else it returns the result of applying the module to the subject using Chili 2.0.</p>
<p>If the ChiliBook option <span style="color: #333399;">recipeLoading</span> is true, any unavailable module will be automatically loaded.</p>
<h5>The new HTML recipe</h5>
<p>As an example, here is the new HTML recipe</p>
<p><pre><code class="javascript">{
	  _name: 'html'
	, _case: false
	, _main: {
		  doctype: { 
			  _match: /&lt;!DOCTYPE\b(?:\w|\W)*?&gt;/ 
			, _style: &quot;color: #CC6600;&quot;
		}
		, ie_style: {
			  _match: /(&lt;!--\[[^\]]*\]&gt;)((?:\w|\W)*?)(&lt;!\[[^\]]*\]--&gt;)/
			, _replace: function( all, open, content, close ) {
				return &quot;&lt;span class='ie_style'&gt;&quot; + this.x( open ) + &quot;&lt;/span&gt;&quot; 
					  + this.x( content, '//style' ) 
					  + &quot;&lt;span class='ie_style'&gt;&quot; + this.x( close ) + &quot;&lt;/span&gt;&quot;;
			}
			, _style: &quot;color: DarkSlateGray; font-weight: bold;&quot;
		}
		, comment: { 
			  _match: /&lt;!--(?:\w|\W)*?--&gt;/ 
			, _style: &quot;color: #4040c2;&quot;
		}
		, script: { 
			  _match: /(&lt;script\s+[^&gt;]*&gt;)((?:\w|\W)*?)(&lt;\/script\s*&gt;)/
			, _replace: function( all, open, content, close ) { 
				  return this.x( open, '//tag_start' ) 
					  + this.x( content, 'js' ) 
					  + this.x( close, '//tag_end' );
			} 
		}
		, style: { 
			  _match: /(&lt;style\s+[^&gt;]*&gt;)((?:\w|\W)*?)(&lt;\/style\s*&gt;)/
			, _replace: function( all, open, content, close ) { 
				  return this.x( open, '//tag_start' ) 
					  + this.x( content, 'css' ) 
					  + this.x( close, '//tag_end' );
			} 
		}
		// matches a starting tag of an element (with attrs)
		// like &quot;&lt;div ... &gt;&quot; or &quot;&lt;img ... /&gt;&quot;
		, tag_start: { 
			  _match: /(&lt;\w+)((?:\w|[?%]&gt;|\W)*?)(\/&gt;|&gt;)/ 
			, _replace: function( all, open, content, close ) { 
				  return &quot;&lt;span class='tag_start'&gt;&quot; + this.x( open ) + &quot;&lt;/span&gt;&quot; 
					  + this.x( content, '/tag_attrs' ) 
					  + &quot;&lt;span class='tag_start'&gt;&quot; + this.x( close ) + &quot;&lt;/span&gt;&quot;;
			}
			, _style: &quot;color: navy; font-weight: bold;&quot;
		} 
		// matches an ending tag
		// like &quot;&lt;/div&gt;&quot;
		, tag_end: { 
			  _match: /&lt;\/\w+\s*&gt;|\/&gt;/ 
			, _style: &quot;color: navy;&quot;
		}
		, entity: { 
			  _match: /&amp;\w+?;/ 
			, _style: &quot;color: blue;&quot;
		}
	}
	, tag_attrs: {
		// matches a name/value pair
		attr: {
			// before in $1, name in $2, between in $3, value in $4
			  _match: /(\W*?)([\w-]+)(\s*=\s*)((?:\'[^\']*(?:\\.[^\']*)*\')|(?:\&quot;[^\&quot;]*(?:\\.[^\&quot;]*)*\&quot;))/ 
			, _replace: &quot;$1&lt;span class='attr_name'&gt;$2&lt;/span&gt;$3&lt;span class='attr_value'&gt;$4&lt;/span&gt;&quot;
			, _style: { attr_name:  &quot;color: green;&quot;, attr_value: &quot;color: maroon;&quot; }
		}
	}
}</code></pre></p>
<p>What to note in the above example:</p>
<ol>
<li>a <span style="color: #333399;">_replace</span> function can be used for applying a recipe to a text run inside another recipe, like the <span style="color: #333399;">script</span> an <span style="color: #333399;">style</span> steps, where highlighting of script and style elements is delegated to <span style="color: #333399;">js</span> and <span style="color: #333399;">css</span> recipes respectively</li>
<li>a <span style="color: #333399;">_replace</span> function can be used for isolating the parsing of a text run, like the <span style="color: #333399;">tag_attrs</span> step, where highlighting of name/value pairs happens only in the context of tag attributes</li>
</ol>
<h5>Module paths</h5>
<p>A module path is an expression that identifies a Chili 2.0 module. A path has three components (though some can be hidden) separated by a / (forward slash), each with a specific meaning: recipe / block / step. (white space added for clarity)</p>
<p>Here is a list of all the combinations in a module path:</p>
<ul>
<li>recipe<br />
a module path like <strong><span style="color: #333399;">css</span></strong> refers to the entire <span style="color: #333399;">css</span> recipe</li>
<li>recipe / block<br />
a module path like <strong><span style="color: #333399;">css/definition</span></strong> refers to the <span style="color: #333399;">definition</span> block of the <span style="color: #333399;">css</span> recipe</li>
<li>recipe / block / step<br />
a module path like <strong><span style="color: #333399;">css/definition/property</span></strong> refers to the <span style="color: #333399;">property</span> step of the <span style="color: #333399;">definition</span> block of the <span style="color: #333399;">css</span> recipe</li>
<li>/ block<br />
a module path like <strong><span style="color: #333399;">/definition</span></strong> refers to the <span style="color: #333399;">definition</span> block of the current recipe</li>
<li>/ block / step<br />
a module path like <strong><span style="color: #333399;">/definition/property</span></strong> refers to the <span style="color: #333399;">property</span> step of the <span style="color: #333399;">definition</span> block of the current recipe</li>
<li>/ / step<br />
a module path like <strong><span style="color: #333399;">//property</span></strong> refers to the <span style="color: #333399;">property</span> step of the current block of the current recipe</li>
</ul>
<p>As you see, leading slashes have a meaning.</p>
<h5>Remember</h5>
<ul>
<li>a recipe module invocation tries to match all the steps of the _main block</li>
<li>a block module invocation tries to match all its steps</li>
<li>a step module invocation tries to match just itself</li>
</ul>
<h4>Help request</h4>
<p>I think that Chili 2.0 is pretty good at highlighting, but it needs more fine recipes to succeed. For this release I&#8217;ve rewritten some from scratch, and converted some others. I&#8217;m not a good programmer in languages other than the ones for which I rewrote a recipe. But if you are and have time and will, then you could write a Chili 2.0 recipe for your favorite language, together with a couple of working samples, and send all to me. I&#8217;d be very happy to add your contributed recipes to the project as soon as they are available.</p>
<h5>Rewritten</h5>
<ul>
<li>CSS</li>
<li>HTML</li>
<li>JavaScript</li>
<li>PHP</li>
</ul>
<h5>Converted</h5>
<ul>
<li>C++</li>
<li>C#</li>
<li>Delphi</li>
<li>Java</li>
<li>LotusScript</li>
<li>MySQL</li>
</ul>
<h4>Setup and Examples</h4>
<p>Here is the <a href="http://noteslog.com/personal/projects/chili/2.0/" target="_blank">start page for Chili 2.0</a> where you&#8217;ll find setup instructions and some examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/chili-20-released-today/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to highlight code in WordPress</title>
		<link>http://noteslog.com/post/how-to-highlight-code-in-wordpress/</link>
		<comments>http://noteslog.com/post/how-to-highlight-code-in-wordpress/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 00:48:47 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[Enzymes]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/how-to-highlight-code-in-wordpress/</guid>
		<description><![CDATA[Although it&#8217;s easy to use WP Chili out of the box, WordPress does have some limitations, like the following: you need to change to the Code editor before adding a snippet to your post you need to make your snippet postable yourself, escaping all HTML entities even if snippets are very short, they are intermingled [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://noteslog.com/blog/wp-content/uploads/2008/03/visual-code.png" alt="WordPress Editing Tabs" /></p>
<p>Although it&#8217;s easy to use <a href="http://noteslog.com/chili/wp-chili/">WP Chili</a> out of the box, WordPress does have some limitations, like the following:</p>
<ul>
<li>you need to change to the <u>Code</u> editor before adding a snippet to your post</li>
<li>you need to make your snippet <a href="http://noteslog.com/personal/projects/postable/">postable</a> yourself, escaping all HTML entities</li>
<li>even if snippets are very short, they are intermingled with their explanations and it&#8217;s tricky to concentrate on writing the best post with so many distractions in between</li>
</ul>
<h4>Using WP Chili &amp; Enzymes</h4>
<p>Now I&#8217;ll show you a better approach by using together <a href="http://wordpress.org/extend/plugins/wp-chili/" target="_blank">WP Chili</a> 1.0 and <a href="http://wordpress.org/extend/plugins/enzymes/" target="_blank">Enzymes</a> 2.2.<br />
All you need to be up and running is the classical roundtrip: download, unzip, upload, and activate.</p>
<h5>How to highlight code snippets</h5>
<p>You can start by writing a simple enzyme for automating things, like the following <u>hilite</u> custom field: <pre><code class="php">return 
'&lt;pre&gt;&lt;code class=&quot;' . $this-&gt;substrate . '&quot;&gt;'
. htmlspecialchars( $this-&gt;pathway ) 
. '&lt;/code&gt;&lt;/pre&gt;';</code></pre></p>
<p><u>hilite</u> can be used with the following patterns:</p>
<ol>
<li><u>{[ =snippet= | .hilite( =language= ) ]}</u></li>
<li><u>{[ .snippet | .hilite( =language= ) ]}</u></li>
</ol>
<p>The first pattern comes in handy when you want to highlight some very short and naive snippet<br />
<u>{[ =echo htmlentities( $name );= | .hilite( =php= ) ]}</u> renders <pre><code class="php">echo htmlentities( $name );</code></pre></p>
<p>So far, so good, but if the snippet has a character that WP texturizes, then <u>hilite</u> seems to fail. In fact<br />
<u>{[ =$welcome \= "Hello ".$name;= | .hilite( =php= ) ]}</u> renders <pre><code class="php">$welcome = &quot;Hello &quot;.$name;</code></pre></p>
<p>The above issue is not a <u>hilite</u>&#8216;s bug but it could be fixed by adding new code to it, or with new enzymes along the pathway, like the following <u>requote</u> custom field: <pre><code class="php">$from = array( '&amp;#8216;', '&amp;#8217;', '&amp;#8220;', '&amp;#8221;' );
$to = array( &quot;'&quot;, &quot;'&quot;, '&quot;', '&quot;' );
return str_replace( $from, $to, $this-&gt;pathway );</code></pre></p>
<p>which makes that <u><br />
{[ =$welcome \= "Hello ".$name;= | .requote() | .hilite( =php= ) ]}</u> renders <pre><code class="php">$welcome = &quot;Hello &quot;.$name;</code></pre></p>
<p><strong>The best option</strong> is to add another custom field for hosting your snippet and use the second pattern: in fact <u>hilite</u>&#8216;s snippet has been rendered by <u>{[ .hilite | .hilite( =php= ) ]}</u> and <u>requote</u>&#8216;s one by <u>{[ .requote | .hilite( =php= ) ]}</u>.</p>
<h5>How to highlight code files</h5>
<p>Sometimes you have a file that you want to show in its entirety, and having to copy it into a custom field is annoying or maybe not an option, if the file is <em>alive</em>, for example.</p>
<p>In such cases you can use an enzyme like the following <u>file</u> custom field: <pre><code class="php">return file_get_contents( $this-&gt;substrate );</code></pre></p>
<p>It&#8217;s use is again very simple and very similar to the above patterns:<br />
<u>{[ .file( =blog/wp-content/plugins/hello.php= ) | .hilite( =php= ) ]}</u> renders <pre><code class="php"></code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-highlight-code-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WP Chili Released</title>
		<link>http://noteslog.com/post/wp-chili-released/</link>
		<comments>http://noteslog.com/post/wp-chili-released/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 22:04:20 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/wp-chili-released/</guid>
		<description><![CDATA[A couple of days ago I released WP Chili, a simple WordPress plugin that installs Chili into WordPress and let&#8217;s you add client-side code highlighting to your posts, with extreme simplicity. After activating WP Chili, it&#8217;s just a matter of wrapping your snippets into code or pre-code elements, with the programming language of the snippet [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I released <a href="http://noteslog.com/chili/wp-chili/">WP Chili</a>, a simple WordPress plugin that installs <a href="http://noteslog.com/chili/">Chili</a> into WordPress and let&#8217;s you add client-side code highlighting to your posts, with extreme simplicity.</p>
<p>After activating WP Chili, it&#8217;s just a matter of wrapping your snippets into <u>code</u> or <u>pre-code</u> elements, with the programming language of the snippet as a class, like in the following example:</p>
<p><pre><code class="html">&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;
echo &amp;quot;Hello $name&amp;quot;;
&lt;/code&gt;&lt;/pre&gt;</code></pre></p>
<p>When the post reaches your readers, the snippet is unescaped by their browser and highlighted by Chili 1.9 (downloaded from your server). Your readers will see the example rendered as:</p>
<p><pre><code class="php">echo &quot;Hello $name&quot;;</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/wp-chili-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HotChili 1.2 Released Today</title>
		<link>http://noteslog.com/post/hotchili-12-released-today/</link>
		<comments>http://noteslog.com/post/hotchili-12-released-today/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 16:33:59 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HotChili]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/hotchili-12-released-today/</guid>
		<description><![CDATA[Changes An updated bookmarklet An updated GreaseMonkey userscript Added support for many more code snippets (hopefully all) IE7 and FF2 work fine Known Issues Sometimes a website (http://developer.mozilla.org) uses an old version of Prototype that makes jQuery fail even if jQuery.noConflict() is used. Sometimes a browser (IE7) cannot load all needed modules in the given [...]]]></description>
			<content:encoded><![CDATA[<h5>Changes</h5>
<ul>
<li>An updated <a href="http://javascript:(function(){var%20d=document;if(!d.createElement){return;}var%20h=d.getElementsByTagName('head')[0];j=function(u){var%20e=d.createElement('script');e.type='text/javascript';e.src=u;h.appendChild(e);return%20e};s=function(u){var%20e=d.createElement('link');e.rel='stylesheet';e.type='text/css';e.href=u;h.appendChild(e);};/*HOTCHILI*/var%20x='http://noteslog.com/personal/projects/';j('http://code.jquery.com/jquery-latest.pack.js').onload=function(){jQuery.noConflict()};j(x+'chili/latest/jquery.chili.pack.js');j(x+'chili/latest/recipes.js');s(x+'chili/latest/recipes.css');j(x+'hotchili/latest/hotchili.js');s(x+'hotchili/latest/hotchili.css');})();" title="HotChili">bookmarklet</a></li>
<li>An updated <a href="http://userscripts.org/scripts/show/10676" title="HotChili" target="_blank">GreaseMonkey userscript</a></li>
<li>Added support for many more code snippets (hopefully all)</li>
<li> IE7 and FF2 work fine</li>
</ul>
<h5>Known Issues</h5>
<ul>
<li>Sometimes a website (http://developer.mozilla.org) uses an old version of Prototype that makes jQuery fail even if <u>jQuery.noConflict()</u> is used.</li>
<li>Sometimes a browser (IE7) cannot load all needed modules in the given sequence, and you get some JavaScript errors.<br />
<strong>Fix</strong>: reload the page and click the bookmarklet again (now the modules will be loaded from your browser cache).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/hotchili-12-released-today/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HotChili as a Bookmarklet</title>
		<link>http://noteslog.com/post/hotchili-as-a-bookmarklet/</link>
		<comments>http://noteslog.com/post/hotchili-as-a-bookmarklet/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 02:33:52 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HotChili]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/hotchili-as-a-bookmarklet/</guid>
		<description><![CDATA[HotChili is now this bookmarklet: HotChili. Previous release was for Firefox plus GreaseMonkey, but as a bookmarklet you can use it from any browser. Known issues Sometimes a browser (IE) cannot load all needed modules in sequence, and you get some javascript errors. The simple fix is to reload the page and click the bookmarklet [...]]]></description>
			<content:encoded><![CDATA[<p>HotChili is now this bookmarklet: <strike>HotChili</strike>.</p>
<p>Previous release was for Firefox plus GreaseMonkey, but as a bookmarklet you can use it from any browser.</p>
<h5>Known issues</h5>
<p>Sometimes a browser (IE) cannot load all needed modules in sequence, and you get some javascript errors. The simple fix is to reload the page and click the bookmarklet again. From now on the modules should be available in the browser cache.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/hotchili-as-a-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chili 1.9 Released Today</title>
		<link>http://noteslog.com/post/chili-19-released-today/</link>
		<comments>http://noteslog.com/post/chili-19-released-today/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 19:50:40 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HotChili]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/chili-19-released-today/</guid>
		<description><![CDATA[UPDATE: Chili 2.0 has been released Changes Circumvented an evil bottleneck Simplified the core clockwork Removed the bundled jQuery library Changed the plugin names to follow the naming convention of jQuery&#8217;s plugins Added a new example showing that Chili 1.9 is much faster Links chili.zip Quick Start Chili Central]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;"><strong>UPDATE</strong>: <a href="http://noteslog.com/post/chili-20-released-today" target="_self">Chili 2.0</a> has been released</span></p>
<h5>Changes</h5>
<ul>
<li>Circumvented an evil bottleneck</li>
<li>Simplified the core clockwork</li>
<li>Removed the bundled jQuery library</li>
<li>Changed the plugin names to follow the naming convention of jQuery&#8217;s plugins</li>
<li>Added a new example showing that <a href="http://noteslog.com/personal/projects/chili/1.9/examples-special.html" target="_blank">Chili 1.9 is much faster</a></li>
</ul>
<h5>Links</h5>
<ul>
<li><span style="text-decoration: line-through;">chili.zip</span></li>
<li><span style="text-decoration: line-through;">Quick Start</span></li>
<li><a href="http://noteslog.com/chili/">Chili Central</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/chili-19-released-today/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Make yourself at home with HotChili</title>
		<link>http://noteslog.com/post/make-yourself-at-home-with-hotchili/</link>
		<comments>http://noteslog.com/post/make-yourself-at-home-with-hotchili/#comments</comments>
		<pubDate>Mon, 23 Jul 2007 21:14:04 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Chili]]></category>
		<category><![CDATA[HotChili]]></category>

		<guid isPermaLink="false">http://noteslog.com/post/make-yourself-at-home-with-hotchili/</guid>
		<description><![CDATA[Syntax highlighting makes code structures pop up, puts order into the intricacies of a program, let&#8217;s you concentrate on the logical connections. Chili does a great job. If you are a blog author, you can easily add syntax highlighting to your scripts, even if you have a very limited control on page generation. And Chili [...]]]></description>
			<content:encoded><![CDATA[<p>Syntax highlighting makes code structures pop up, puts order into the intricacies of a program, let&#8217;s you concentrate on the logical connections.</p>
<p>Chili does a great job. If you are a blog author, you can easily add syntax highlighting to your scripts, even if you have a very limited control on page generation. And Chili does offer you many configuration options, including the possibility to adapt color schemes at your taste. In fact, the CSS for a language is maybe the first thing Chili users change. They want their highlighting to suit their vision, they build a pattern that matches their engine.</p>
<p>HotChili is better. If you are a blog reader, you can easily* add syntax highlighting to scripts that are not yours, even if they are already highlighted. Pretty cool: you can adapt almost any script to your color scheme!!</p>
<p>* (two clicks)</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/make-yourself-at-home-with-hotchili/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

