OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] Syntax highlighting

On Sat, 2013-12-07 at 15:26 -0600, David Cramer wrote:
> On 12/07/2013 01:38 AM, davep wrote:
> > On 06/12/13 21:53, Norman Walsh wrote:
> >> Hello world,
> >>
> >> A fair bit of effort in the DocBook stylesheets goes into parsing,
> >> decomposing, annotating, and recomposing program listings for the
> >> purpose of adding line numbers to them. There's also a bunch of work
> >> that goes into syntax highlighting them.
> >>
> >> Occasionally, this takes a *long* time.
> >>
> >> It appears that modern systems do this in the JavaScript layer on the
> >> client. They also use tables to render line numbers.
> We use the popular syntax highlighter:
> https://github.com/alexgorbatchev/SyntaxHighlighter
> But we had to adapt it to support callouts and markup inside the code
> sample. Without our modifications, the js highlighter would end up
> displaying the html markup from the inline markup and the callouts as if
> it were part of the code sample. Here's an example of our version:
> http://docs.rackspace.com/servers/api/v2/cs-devguide/content/curl_summary_xml.html
> On the downside, it adds weight to the page.

Yelp uses jQuery.Syntax for syntax highlighting, which we've been pretty
happy with. I've had no problems with it clobbering markup inside code
blocks, which is something I deal with pretty often.


Yelp does still do line numbers is XSLT though. Also:

> One caveat about using tables for line numbers. It generally makes it
> impossible to cut and paste the code sample without getting all the line
> numbers. One thing I like about the syntax highlighter above is that
> when you click on the code sample, the callouts go away and are not copied.

Yelp puts the line numbers in a single pre that is float: left (or right
in RTL) next to the code block. It's the best solution I've found.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]