Line Continuations in HTML

Return to notes

Style #1: Line continuation characters at the beginning of the line..

Derived from an answer provided by Jack Ryan.

c:\Program Files\My Application\Module\bin\..> Some really long command line "with parameters" "that just go on and on" " that should all be typed on one line" "but need to be wrapped for display and I'd like the text style to indicate that it has wrapped"

c:\..> this shouldn't wrap

Normal body text here.

Style #2: Line continuation characters at the end of the line..

Derived from an answer provided by Maarten Sander.

c:\Program Files\My Application\Module\bin\..> Some really long command line "with parameters" "that just go on and on" " that should all be typed on one line" "but need to be wrapped for display and I'd like the text style to indicate that it has wrapped"

c:\..> this shouldn't wrap

Normal body text continues here..

Style #3: Using a modified syntaxhighlighter..

syntaxhighlighter is a great little project by Alex Gorbatchev. It is great for styling code examples, but the current version 1.5.1 doesn't support line wrapping.
I've modified it to support a wraplines parameter, demonstrated below with a java example. See the included shCore.js - search for comments about '...wraplines support'. Note that IE rendering can be a bit dodgy - need to scroll for example to get it to refresh clean.
The patch to shCore.js on its own will get the wrapping working. I've also tweaked the li style in this page to include the continuation glyph.

For comparison, here is the rendering without wraplines support enabled: