(This article was first published on

**jkunst.com: Entries for category R**, and kindly contributed to R-bloggers)I searched for a javascript plugin to highlighter code, but obviously not any code. I needed to higlight R. Finally I founded highlight.js. Highlights.js is pretty cool for many reasons. I like Highlights.js because:

- Support R lenguage.
- It's easy to use. Works automatically. That's mean you don't have to put the code what are you writing. Highloght it does alone.
- A lot of styles.
- And yep! Again! Support R lenguage.

```
library(ggplot2)
centre <- function(x, type, ...) {
switch(type,
mean = mean(x),
median = median(x),
trimmed = mean(x, trim = .1))
}
myVar1
myVar.2
data$x
foo "bar" baz
# test "test"
"test # test"
```

And an example of python code:

```
def cov(x,y):
n = len(x)
xmn = mean(x)
ymn = mean(y)
xdeviations = [0]*len(x)
ydeviations = [0]*len(y)
for i in range(len(x)):
xdeviations[i] = x[i] - xmn
ydeviations[i] = y[i] - ymn
ss = 0.0
for i in range(len(xdeviations)):
ss = ss + xdeviations[i]*ydeviations[i]
return ss/float(n)
def cor(x,y):
return cov(x,y)/(var(x)*var(y))**.5
```

Nice!

To

**leave a comment**for the author, please follow the link and comment on his blog:**jkunst.com: Entries for category R**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...