[R] R-code in html help pages: syntax highlighting
romain.francois at dbmail.com
Mon Mar 16 22:06:46 CET 2009
hadley wickham wrote:
>> It would be pretty easy to use the output from the R parser (which is never
>> wrong, is it?), and dump some markup out of it. For example the showTree
>> function in codetools dumps an R expression as Lisp, this is not too far
>> from generating html, or any other markup.
>> As this sounds like fun, I'll volunteer to do something about this. Another
>> advantage is that we can imagine to plug hyperlinks in R code that lives in
>> html help pages.
> This also sounds like a good idea for a google summer of code project
> - that way you might be able to get a student to give you a hand as
That did cross my mind earlier this evening, it just seems a bit too
easy to last all summer, but maybe I am missing something difficult. I
will start to play with this over the next few days, and make up my mind.
One of the problem I might run into is performance, if we want this to
treat all Rd files, we are going to want something very efficient, and
it might not be enough to build on top of codetools (which uses
recursion at the R level) , but could make sense to provide a C level
This could lead to interesting things as:
- syntax highlighting in sweave (or decumar)
- pretty printing in the console (using ansi characters)
- syntax highlighting in R help files, potentially with hyperlinks
I have requested creation of a project on r-forge. Anyone else want to
play with this ?
Independent R Consultant
+33(0) 6 28 91 30 30
More information about the R-help