How to Highlight Mixed Language Source Code

Web pages contain many snippets from different languages, like HTML, PHP, CSS, and JavaScript. Chili 1.x cannot highlight mixed language source code automatically, but the forthcoming released Chili 2.0 will be is able to do that.

Meanwhile, if you are using a Chili + Enzymes setup, then it’s possible to write an Enzymes template capable of making Chili 1.x highlight a web page perfectly (expanding on my previous php template).

Here is the new updated (2007/02/19) chili-web.php Enzymes template. At the moment it supports XHTML, and embedded CSS, JavaScript, and PHP snippets.

{[.chili-web /enzymes/chili-web.php]}

The WordPress file /wp-content /themes /default /comments-popup.php is a page that uses all the supported languages, so it’s a good test for the previous template:

{[.test /enzymes/chili-web.php]}

Chili & Enzymes confirm to be a perfect match.

HTML Recipe: Tighter Values

There a was a bug in the highlighting of attributes’ values. The problem was that any string got highlighted, even if it wasn’t preceded by an equal sign. That’s fixed now.

Also I’ve added the PHP’s opening and closing tags.

{[.recipe /enzymes/chili-js.php]}