RFC: line numbered programlisting in HTML docs

Warren Block wblock at wonkity.com
Tue Jan 21 15:30:41 UTC 2014


On Tue, 21 Jan 2014, Gábor Kövesdán wrote:

> in the pdf version of the documentation we have rendered line wrap indicators 
> that show the reader when a long line has been wrapped into multiple lines so 
> that it can be rendered. In the HTML version we have scrollable 
> programlistings, which is not so smart since you may need to scroll to read 
> all of the code, which is not comfortable. Using line wrap indicators in HTML 
> is only possible with an ugly CSS trick but if we number the lines, which in 
> turn is quite easy, it becomes obvious when a long line is wrapped. This is 
> what I propose for programlisting and screen elements. Also, line numbering 
> is a useful feature in itself.
>
> Demo: http://kovesdan.org/doc/proglist.html
>
> Patch: http://kovesdan.org/patches/programlisting.diff

It's interesting, and looks nice.

There's no clear indicator of what the single-digit line numbers 
mean, but that's probably not serious.

Another concern is cut and paste, whether the long line pastes as a 
single line or not.  Firefox seems to have a ongoing bug and pastes 
*everything* copied as a single line anyway.

With Midori, the long line and the rest of the content pastes correctly.

Are blank lines not numbered, or is the blank second line added by the 
markup after long lines?

For programlistings, I think this is fine.  On screen elements, the 
added line numbers may not help, but we have fewer screen elements with 
too-long lines.


More information about the freebsd-doc mailing list