tadhg.com
tadhg.com
 

jEdit and Document Structure

22:33 Thu 08 Mar 2007
[, , , , ]

I’ve recently been writing documentation at work, and have been writing it in HTML, which is more or less my native format for that kind of writing. In doing so, I’ve been focusing more on document structure and how it aids usability for the reader. Over the last couple of weeks I’ve also started to focus on how it might improve usability for the author.

For example, if the table of contents for a piece of documentation includes links allowing the reader to jump to specific content (which it obviously should) why shouldn’t that be available to the author as well? Plenty of IDEs do this for programming languages like Java, with a panel showing the methods in a file as a kind of map to the document.

If I’m writing well-structured, semantically-sound (X)HTML, shouldn’t I get something like that too?

jEdit is my editor of choice, and it turns out that not only does it support this for XML and HTML, but I already had the plugin (SideKick) installed. It provides a tree view of the document being edited.

That’s rather excellent, but despite being more or less exactly what I had had in mind, I ended up rejecting it, because it’s too mouse-based for me. Here’s what it looks like in jEdit, with the tree on the right:

SideKick on the right in jEdit

Unwilling to use it via the mouse, I started considering jEdit’s folding capabilities again. These allow you to view files with certain sections “folded” so that their lines are hidden. This can be useful, but I didn’t like putting in manual folding markers, and the indentation mode didn’t quite work for me either. But for the first time I noticed that it had an option for a “sidekick” mode.

In other words, SideKick would tell it what the discrete sections were, and it could treat them as folds. That turned out to be completely perfect, allowing me to hide away everything I wasn’t working on. And folds in jEdit are easily accessible via the keyboard (using Alt-Enter and Alt-Backspace, for the most part).

I used them for most of what I was doing today, and I think this is the first major change in how I use jEdit in several years. Naturally, I now want this capability for other languages, especially JavaScript. Looking into this, I see that there’s a Ctags plugin that uses SideKick, meaning that it will be able to extract the requisite semantic/structural info from files of many more types. I need to update jEdit to test it out, which I’ll do soon.

In the meantime, I’m rather happy to see that the rich semantic/structural advantages are being taken advantage of by editors as well as readers. And now that I’m more used to folding, I suspect I’ll start using its indent mode for JavaScript.

(next) »

Leave a Reply