I'm trying to understand the rouge
syntax highlighter and in particular use it to highlight R code. Ultimately it's for a website built with jekyll
but I've been able to isolate my problems to just rouge
(eg I use rougify
on sample code to produce inspectable HTML).
My problem is that most of my code is given class = "n", which I think stands for "name" and is not distinguishable from arbitrary variables. Most CSS for syntax highlighters I think leaves code of class "n" untouched. Here's an example of what's generated from library(ggseas)
:
<span class="n">library</span><span class="p">(</span><span class="n">ggseas</span><span class="p">)</span><span class="w">
From what I understand of the discussion on this pull request, rouge
highlighting of R only worked at all from early June. Looking at what I'm pretty sure is the key bit of code in the source for rouge
, I think that only functions in the variable PRIMITIVE_FUNCTIONS
are going to be highlighted. In other words, by leaving all non primitive functions unhighlighted rouge
is working as it should, it just has got a very limited sense of R syntax.
My question is, have I understood it right?
I need things like library()
and ggplot()
to be highlighted even though they aren't primitive functions in the base package of R. If I have understood things correctly, I will either have to hack the source of rouge
to include more functions or try to move to something else.