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.

PunchCard 1.2 Released Today

Changes
  • Simplified the inclusion of the PunchCard code in a page
  • The configuration of a widget is now by means of a metaboject, and is compliant with XHTML 1.0 Strict
  • Updated the code to use version 1.1.1 of the jQuery library (bundled)
  • The example.html file shows how to put on the same page as many widgets as you like. Each of them can have it’s own style
  • Simplified the stylesheets. Add new styles for colors and shapes of the widgets to the punchcard.css stylesheet (compare with example.html)
Files

(the greeny thing below this line is a punchcard)

Chili 1.5 Released Today

UPDATE: Chili 1.6 has been released

Changes

  • Changed the recipes format to JSON. Previous recipes need a small conversion. Just compare to a JSON recipe and you’ll see how to
  • Improved support for dynamic setups, by means of metaobjects, which allow a clean configuration on a per element basis
  • Improved support for static setups
  • New examples show how to configure static and dynamic setups
    • static: recipes and stylesheets linked from the page
    • dynamic: recipes and stylesheets downloaded on demand
  • The examples also show how to mix languages in the same page, manually configure a mixed language setup, use metaobjects, use a dynamic download in a static setup
  • Added an option for preventing CSS downloading on demand
  • Added a new recipe and example for pure HTML
  • Updated the bundled jQuery library to version 1.1.1
  • Dropped support for Code Highlighter styleSets. It’s very easy to convert a styleSet to a JSON recipe, though
  • Fixed a bug in the white space’s rendering
  • Improved the white space’s rendering in Opera9.1
  • Added scope protection to all the Chili code
  • Tested with IE7, FF1.5, Opera9.1

Files

  • download all in a zip
  • read the manual
  • Examples (static)
  • Examples (dynamic)