2006/05/08

HTML+CSS for rich text rendering

Here’s a thought. In the beginning, XHTML+CSS was able to produce content with fairly minimal style. Over time, it’s improved to the extent of supporting many of the things possible with more classical “word processors”.

Selectors in CSS3 make for robust and easy tools for complex formatting. CSS supports things like page breaks and fixed layouts as found in traditional documents — it just happens to be the case that we generally like web pages to be of indeterminate height and width (the latter sometimes less so).

As long as the stylesheets provide the ability, there are no troubles with footnotes (or margin notes) and running headers. Source transformations (XSLTs) make tables of contents and indices easy, as far as I can tell. How long before someone produces an easy-to-use HTML authoring platform that produces variable layouts (screen, print, web) with no trouble at all. The input could be reStructuredText to support a greater range of elements than Markdown, while still having that whole “looks like an email” simplicity.

Where does this scheme fall down? Microtypography is always a concern and pdfTeX is as yet unmatched, although InDesign does some great on-the-fly kerning that I’d like to investigate if I had more time. Perhaps a CSS interpreter in TeX would be a nice idea…

Have other people tried this already? There are a bunch of formats for publishing to different outputs, but I don’t see any of them leveraging the full power of XML+CSS. And that’s the whole charm; producing the output is the hard part, and if it can be specified simply with structured input and some formatting rules, a lot of time is saved not having to deal with building document renderers.

All in all, just something I wanted to let my mind wander on for a few minutes. It’s not trying to solve a problem, just express my admiration for the fact that it seems possible that “browsers” will be all we’ll need in the future; who even needs to worry about PDF? Seriously, with MathML, SVG, fixed layouts and the possibility of embedded fonts (okay, that point is actually a problem not likely to be overcome), the world of XML documents is going to be huge.