Luminous 0.7 development

Published April 15, 2012

Development has started on the 0.7 branch. One of the reasons for advancing the version number is because there are some changes that are going to be backwards incompatible, so this is a heads up.

0.7 will see a radical overhaul of the line numbering system and move it from generating the numbers in PHP to a pure CSS solution. Line numbers have always been a pain; the current solution is to place the numbers and code in two adjacent table cells (I've seen other highlighters do this too) because this solves a number of problems which otherwise occur. This markup is obviously not ideal. Line numbers are more meta or presentational than content and having them in the markup at all seems wrong, and no less so when that markup starts using tables for behaviour and presentation. From a practical point of view, search engines and presumably screen readers and so on have a hard time picking out what's important (the code) from what's not (the numbers), and appearing in Google with a summary consisting of a long list of integers is kind of silly, but it is currently happening.

I've seen other highlighters try to use ordered lists, but these are difficult to style and still semantically totally wrong. So instead 0.7 will use CSS counters and inject into lines them using :before pseudo-elements. So far it's working quite well with a few minor workarounds. This does mean we might lose word-wrap functionality, but this was kind of ugly anyway so I don't imagine it will be missed.

With the absence of explicit line numbers, things get lighter: As a rough number, the markup size is around 70% of what it was before. Also we can drop the bundled fonts (the reason for these existing was because the line numbers and code could end up out of synch using some fonts when a line had italicised text on it), and make the CSS a bit more compact.

I've switched luminous.css to use SASS instead of plain CSS which makes things much more manageable. Theme files will remain in plain CSS because they are relatively simple and it makes them easier for users to copy/modify.

I've also cleaned up the markup greatly. There was some legacy cruft that needed cleaning, Luminous output is now just a <div> wrapping a <pre>.

Other plans for 0.7 are supporting SASS's SCSS syntax for definite (although I'm a little intimidated by the apparent grammar...), and probably its whitespace SASS syntax too assuming it's not too hard to equate them (I don't really want two separate scanners). I'm also hoping to sort out the internal token representation (hopefully no more XML and string replacements in formatters).