How to choose a different theme / style for CodeRay syntax highlighting Ruby code?

I find it difficult to figure out how to choose a different theme / style to highlight the syntax of the Ruby code using CodeRay code, by default this is fine, but I wonder if there is anything else? I can not find them.

thank

+3
source share
2 answers

I understand that you are creating your own coderay.css file. Coderay does not have "themes."

0
source

Try the following:

CodeRay Style Sheet

And then:

doc = Nokogiri::HTML(html)
  doc.search("//pre//code[@class]").each do |pre|
    tokens = CodeRay.scan(pre.text, pre[:class])
    pre.replace tokens.div(:css => :class)
  end

The trick is to make your markers with a CSS class.

0
source

Source: https://habr.com/ru/post/1795521/


All Articles