Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

make formatR and highlight optional? #211

Closed
yihui opened this Issue · 3 comments

2 participants

Yihui Xie Ramnath Vaidyanathan
Yihui Xie
Owner

reasons:

  1. dependency chain too long which slows down the package loading

    > system.time(require('knitr'))
    Loading required package: knitr
       user  system elapsed 
      0.688   0.016   0.705 
    
  2. in the future we probably will not need highlighting on R's side; markdown + js should work well

  3. the highlight package has a bug which seems to take forever to fix (it creates a global variable txt), so does feature request #31
Ramnath Vaidyanathan

Although, using js to syntax highlight code seems to be a cleaner solution, none of the currently popular js highlighters solutions including google prettify seem to have satisfactory lexers to parse R code. I have created a workaround, where I fool knitr into thinking that the document's output format is html and also to render any executed code in html. I then pass this pseudo markdown document to markdown which works. I will put it up as a gist, once I clean my code.

Meanwhile, if you are aware of js highlighters that do a reasonably good job of highlighting R code, please let me know.

Ramnath Vaidyanathan

I take that back. A little digging revealed that the RStudio folks have contributed an R syntax highlighter to highlight.js. It is available only in the development version on github. I downloaded it and played with a few themes, and it seems to work really well. The only drawback is that the CDN hosted version of highlight.js does not include R, so it will have to be self-hosted.

Yihui Xie
Owner

hmm, it seems they release a new version roughly biannually; web products should be updated much more frequently, I think

Yihui Xie yihui closed this in ddd8c4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.