shjs

GNU Source-highlight 2.9

Lorenzo Bettini just released version 2.9 of GNU Source-highlight. New in this version is the improved handling of C and highlighting of properties, KDE desktop and ini files, lsm, rpm spec, and haXe. Check out the news over at his blog for more details and some examples.

There are various other highlighting tools, which are based on GNU Source-highlight. SHJS is one of 'em and it's the one I'm using over here (via SHJSFilter). That's why I wrote the language definition for haXe. Lorenzo Bettini was very helpful and responsive in the process. If one of your favorite languages is missing, give it a try - it's actually quite easy to do.

SHJS Filter R4

Changes/Improvements:

  • offset shift fixed

The offset for the next turn wasn't adjusted. Now it uses arrays and replaces the the whole lot at the very end. Well, weird code leads to silly mistakes. ;)

Download: SHJS Filter (6kb - same location)
Project page on Google Code: http://code.google.com/p/shjsfilter/

If there are any problems post em on the issue tracker.

SHJS Filter R3

Changes/Improvements:

  • tab size per format
  • spelling+grammar
  • short tip updated
  • long tip updated

New Features:

  • generic code formatting via <code>...</code> and <shjs:generic>...</shjs>
  • default language (per format) via <shjs>...</shjs>
  • custom highlighting themes can be now put into the themes directory - this makes accidential deletion harder ;)

Download: SHJS Filter (6kb - same location)

SHJS 0.4.2 Out Now!

Check out the news for a complete list of improvements and bugfixes. The most important ones for me are the escape order fix (for strings like '\\') and highlighting of variables in PHP and Python.

I also like how URLs are now turned into proper hyperlinks. :)

Grab it over at sf.net. If you find any issues or if you have ideas for improvements, head over to the tracker.

SHJS Filter R2

Changes:

  • one brainless statement removed
  • auto close added

The implication of the latter is that code, which was cut off (teaser view) will be properly highlighted and escaped. The cutoff is indicated via "[...]".

Well, the potential cutoff, that is. If you forget the closing </shjs> tag, you'll also get that "[...]" thingy. Maybe it will be possible to do that in a more sensible fashion with Drupal 6.x.

Download: SHJS Filter (4kb - same location)

Easier SHJS Theme Debugging with Opera

Opera is currently a bit ahead here and there. In this case it's using a span's class as content. Usually Firefox (or Gecko for that matter) can do this as well, but it doesn't want to do it, if they were injected into the DOM via JS.
opera works
This is how it's supposed to look like. For getting that kind of effect simply add the following CSS to your theme:

pre.sh_sourceCode span:hover{
  content:attr(class);
}

Don't forget to remove it once you're done. ;)

SHJS Template Generation

Highlighted CSS looked sorta bad with the Eclipse theme. I tried a few other themes, but they didn't really change much. The reason for that is that all of those themes only cover a specific subset of the available shjs-classes and eventually a few more here and there. For the most part... not even half of the stuff is covered.

Writing your own theme, which covers at least the set of languages you're going to use is quite troublesome. You have to walk through all language scripts and assemble massive lists of classes with matching comments - before you can even start with the styling.

The solution? A quick'n'dirty hack of course! :)

SHJS Filter Release

A rough overview of the visible improvements:
SHJS Filter Improvements
Ye, I guess I'm pretty happy with it now. :)

SHJS Progress

The Drupal module is pretty much done now. Here you can see the settings form and some example source (Java, PHP, Perl and Python) highlighted in Eclipse and Emacs flavors:
SHJS Filter Settings SHJS Eclipse and Emacs Style

Maybe I'll add a checkbox for minimal mode tomorrow, but that's about it.

Syndicate content