Method: Riven::Markup::CodeBlock#highlighted

Defined in:
lib/riven/markup/code_block.rb

#highlightedString

Returns the code with syntax highlightning

Returns:

  • (String)


18
19
20
21
22
23
24
# File 'lib/riven/markup/code_block.rb', line 18

public def highlighted
  if @language
    CodeRay.scan(@code, @language).div(tab_width: 4)
  else
    CodeRay.scan(@code, :text).div
  end
end