Testing highlight.js with R code
[This article was first published on jkunst.com: Posts for category R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
function(x, inf = -Inf, sup = Inf){
if(missing(inf)) return(ifelse(x < sup, x, sup))
if(missing(sup)) return(ifelse(x > inf, x, inf))
x <- ifelse(x < sup, x ,sup)
x <- ifelse(x > inf, x ,inf)
return(x)
}
And an example of python code:
class RandomPostView(View):
template_name = "blog/post.html"
def get(self, request, *args, **kwargs):
post = Post.objects.filter(status = 1).order_by('?')[0]
return HttpResponse('Hello, World!')
Nice!
To leave a comment for the author, please follow the link and comment on their blog: jkunst.com: Posts for category R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.