Chili NEXT

By , 2006-11-07 04:24:21

Chili – The jQuery Plugin for Highlighting Code

I’ve setup a GitHub account for Chili, so that anyone interested in forging the NEXT version can easily join and contribute.

I’m still new to git, but I hope I have prepared a usable setup for development.

What follows is version 2.2 content. It’s a bit outdated, but still useful. (to be updated)

Main links

Features

  • Very fast highlighting, trivial setup, fully customizable, thoroughly documented, and MIT licensed
  • Renders identically on IE, Firefox, Mozilla, Opera, and Safari
  • Comes bundled with recipes for C++, C#, CSS, Delphi, Java, JavaScript, LotusScript, MySQL, PHP, and XHTML
  • Many configuration options: Static, Dynamic, Automatic, Manual, Ad-Hoc, with Metaobjects.
  • Provides fine control over which elements get highlighted by means of a jQuery selector or the mithical jQuery chainability.
  • Fully supports javascript regular expressions, including backreferences
  • The replacement format gives full control on what HTML is used for highlighting
  • Provides examples which show setups and features

Reviews

Integrations

Leave a Reply

111 Responses to “Chili NEXT”

  1. Felipe says:

    Is there any luck to see this (fairly complicated) example nicely highlighted?
    http://planetozh.com/blog/2007/06/text-editors-for-coders-deathmatch-review/

  2. [...] Chilli source highlighter [...]

  3. Andrea Ercolino says:

    It’s a good idea, but what could be the reason for having selectionHelper = false?

    Without the selection helper it’s not WYSIWYG: i.e. you can’t select, copy, and paste the text as you see it, with proper whitespace.

    Internet Explorer and Mozilla differ in what ‘mistakes’ they introduce into the selected text, but neither is like Opera or Safari, which properly do the job.

  4. Max says:

    Hi, can you make the selectionHelper as an option?
    simply make a new option:

    ChiliBook = {

    , selectionHelper = true

    }

    and change the lines 472-474 of the makeDish-Function:
    if( ( $.browser.msie || $.browser.mozilla) && ChiliBook.selectionHelper ) {
    enableSelectionHelper( el );
    }

  5. Andrea Ercolino says:

    @Nico

    Static and dynamic setups can be mixed only for different recipes.

    The “recipes.js” file that comes with Chili is an example of what you need to do to have your viewers download at once the recipes you are going to use.

    So, if you only need “csharp.js” and “js.js”, you should copy and paste those recipes (and just them) inside “recipes.js”, along the same line as the example.

  6. @Andrea – I’m actually getting errors using the static recipes, and I’m not sure why.

    This page works fine, color coding some javascript:
    http://www.icoblog.com/2008/06/dhtml-bookmarks-using-jsurl.html

    But I see erros like this:

    invalid label
    , _case: true\n
    csharp.js (line 14)

    I also can’t seem to get the csharp coloring to work.

    Any thoughts? (if you could email me I’d appriciate it)

  7. @Andrea, yes I was looking at JSONP myself, looks like from the docs that the jQuery guys suggest it: http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback

    Thanks for the static tip, I should have thought of that.

  8. Bastian says:

    I have found a little bug in a RegExp!

    css.js -> _element -> /\w+/
    It highlights too much! e.g. when I want to highlight something like this:

    ul.post-meta {
    /*some styles*/
    }
    It would highlight “meta”, too!

    So I’ve made a new RegExp:
    /(\s|^)\w+/

    and that’s it!
    P.S.: I’m not good in RegExp.

  9. [...] Chili és un plugin de JQuery que permet colorejar diferents sintaxis. [...]

  10. Andrea Ercolino says:

    @Nico Westerdale:

    This seems a JSONP issue. I’ll work on it shortly. Thanks.

    Anyway, Chili supports a static setup that let’s you skip AJAX downloading. It’s the best solution for you now.

    Pack all the recipes you need into a recipes.js file, like the one that’s included with Chili 2.0. Then the following lines should do the trick:

    <script type="text/javascript" src="http://jquery.com/src/jquery-latest.pack.js"></script&gt;
    <script type="text/javascript" src="http://example.com/chili/jquery.chili-2.0.js"></script&gt;
    <script type="text/javascript" src="http://example.com/chili/recipes.js"></script&gt; <!-- Chili settings for a static setup -->
  11. Andrea Ercolino says:

    @Viper007Bond:

    I know it’s a bit annoying to add the PHP tags, but an HTML page is a valid PHP script… no tags means no PHP.
    Anyway, only the starting tag (<?) is really needed.

    You can change the PHP recipe to fit your needs.

  12. [...] Ercolino による Chili と呼ばれる jQuery [...]

  13. Viper007Bond says:

    Oh how I love Chili!

    However, I have issues with code (PHP in this case) showing, being highlighted, and then immediately disappearing.

    Also, I wish there was a way I didn’t have to wrap my PHP code pastings in <?php and ?> in order to get it to highlight. I guess it should assume the code is PHP unless the PHP tags are inside the paste.

  14. Any chance that you could make Chili work so that you can host the .js files on a different domain? With our blog we have all the script files hosted on our main site and use Blogger to publish, but don’t have the facility to publish .js files on the blog’s domain. As Chili uses Ajaz to load it’s recipies then this fails across domains. If there was facility for a non Ajax option for the recipies this would allow greater flexibiliy in this type of situation.

    Let me know!

  15. [...] hacerlo automáticamente es muy fácil, solo hay que utilizar la librería para jQuery llamada Chili y entre las características que tiene [...]

  16. [...] Notes Log » Chili 1.9 Chili is the jQuery code highlighter plugin. (tags: javascript jquery syntax highlighter) [...]

  17. [...] preview pager jQuery Plugin shortKeys jQuery Plugin jQuery Biggerlink jQuery Ajax Link Checker Chili jQuery code highlighter plugin [...]

Panorama Theme by Themocracy