[R] Help request: highlighting R code on WordPress.com blogs

Andrew Redd aredd at stat.tamu.edu
Thu Sep 9 22:12:53 CEST 2010


The question would be performance issues for having too many
functions. We could just limit it to the reserved keywords.  Another
option for the functions is to highlight anything that looks like a
function with the regular expression /[\w._]+(?=\()/  that is any
function name with periods and underscores that is immediately
followed by an open parentheses, or optionally by any number of spaces
then an open parentheses /[\w._]+[ \t]*(?=\()/
-Andrew


On Thu, Sep 9, 2010 at 1:01 PM, Yihui Xie <xie at yihui.name> wrote:
> Thanks, Tal. It does not look too difficult to write such a "brush",
> which is actually a JS file. However, I have a concern that R has
> thousands of functions (in base R only), so it might not worth
> including all of them in the brush, which is the way that they
> implemented the highlighting script for Java and VB (they didn't
> define the list of functions because there are too many). Then what we
> need to do is just to insert a few keywords like TRUE/FALSE/for/while
> in the JS. I would like to contribute 10 minutes on this if nobody
> will pick up this job.
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyihui at gmail.com>
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
>
>
>
> On Thu, Sep 9, 2010 at 3:02 AM, Tal Galili <tal.galili at gmail.com> wrote:
>> Hello dear R help members (and also Yihui and Romain),
>> There are currently 28 R bloggers (out of the 117 R-bloggers I know of) that
>> are using wordpress.com for publishing their R code (and I suspect this
>> number will increase with time).
>> WordPress.com doesn't support R syntax highlighting, nor can it
>> be embedded from other services (like gist git)
>> After contacting the WordPress.com vip manager, he instructed me that they
>> will add R support if a relevant "brush" will be created according to this
>> document:
>> http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html
>> Since this is what they use on wordpress.com (see:
>> http://en.support.wordpress.com/code/posting-source-code/).
>> Creating this brush is beyond my ability at this point, I am writing to ask
>> if any of you can/wishes to make this brush for the community.
>> Something I thought might be relevant is the code Yihui Xie recently wrote
>> for creating a NPPtoR code brush
>> (http://yihui.name/en/wp-content/uploads/2010/08/Npp_R_Auto_Completion.r)
>>
>> If such a brush will be created, I'll push to have it included in
>> wordpress.com and to try and inform the current R bloggers using it.
>>
>> Best,
>> Tal
>>
>> ----------------Contact
>> Details:-------------------------------------------------------
>> Contact me: Tal.Galili at gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>> ----------------------------------------------------------------------------------------------
>>
>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list