Feature Proposal: Replacement for chili syntax highlighter

Motivation

Our documentation now shows errors "Error: no such plugin chili" (see JQueryChili). We need to have a replacement for this. And because we have a lot of TML code examples, we will make the code better readable (as it was, actually).

Description and Documentation

A good candidate is Prism:

Prism is a new lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.

It is possible to write syntax and display plugins.

No IE 6-8 support.

Examples

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: ArthurClemens - 11 Oct 2012

Discussion

I think we can turn it back on. Firefox is long since fixed.

-- GeorgeClark - 11 Oct 2012

Highlight.js or SyntaxHighlighter are good replacement candidates.

-- MichaelDaum - 11 Oct 2012

I still don't understand why we don't just re-enable Chili. It's already enabled on trunk. The issues with Chili are due to a bug in Firefox and Safari regex processing. Firefox is fixed. I suggest we turn Chili back on for 1.2 and 1.1.6.

-- GeorgeClark - 12 Oct 2012

Don't forget to keep Tasks.Item11254 up-to-date.

-- PaulHarvey - 12 Oct 2012

FWIW I don't care how new & shiny the new highlighter is, just that either:
  • The new project is stable with a clear longevity (Eg. google's crappy syntax-highlighter)
  • OR we make it easy to switch highlighting engines, assuming Prism is an abandoned project some time soon

That's what Tasks.Item11254 was about.

-- PaulHarvey - 12 Oct 2012

Yes, please enable chili again and remove the warning in configure. That's out of date info there. I am okay with keeping chili at the moment. There are however good alternatives.

-- MichaelDaum - 12 Oct 2012

Current action: enabe chile. After 1.2: investigate alternatives.

-- ArthurClemens - 24 Oct 2012

Chili 2.2 does not work with IE 7. It seems that neither does Prism, so I would recommend to keep these things off unless they work (or degrade) reasonably well with older browsers.

-- KipLubliner - 25 Oct 2012

Kip, what do you mean with "does not work". Does it mean: there's no highlighting? Does it generate a javascript error? Or does it only not colorize anything? If the latter is the case, then I'd call it graceful degration ... as with so many other things related to legacy browsers.

Just checked it in IE8 Compatibility Mode (which is as close as can be to IE7): no javascript errors, highlights the code as expected:

<html> 
  <head> 
    <title>Hello World</title> 
  </head> 
  <body> 
    <font size="24px">Hello World</font> 
  </body> 
</html> 

-- MichaelDaum - 25 Oct 2012

IE7 does coloring alright, but the pre block is collapsed:
ie7.png

-- ArthurClemens - 25 Oct 2012

This happens on IE7 and IE8. I don't see the scrollbars at http://trunk.foswiki.org/Sandbox/PreTest. These could be a result of the pre styles in the base_src.css.

However, I can't reproduce this on my own checked out trunk installation.

After some investigation it turns out that this only happens with jquery-1.7.2. It is all right in jquery-1.8.x

This seems to be a bug in jquery-1.7.2 replacing \n with a br. ... Tasks.Item12195

-- MichaelDaum - 26 Oct 2012

Michael is also saying - this is thus fixed in 1.2.0, as he's just upgraded it to default to 1.8.2 smile

-- SvenDowideit - 27 Oct 2012

I was talking about the fact that everything is forced to be on one line, as in Arthur's screenshot. Sorry that I was imprecise.

-- KipLubliner - 27 Oct 2012

Kip, switch your jquery to version 1.8.2. This fixes it.

-- MichaelDaum - 28 Oct 2012

Michael, I saw your checkin to change the default, thanks for fixing this. I will try it out in 1.1.6 rc.

-- KipLubliner - 28 Oct 2012
 
Topic revision: r17 - 09 Feb 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy