class HLJS::Adapters::SyntaxHighlighter

Public Instance Methods

highlight(code, lang) click to toggle source
# File lib/hljs/adapters/syntax_highlighter.rb, line 9
def highlight(code, lang)
  check_if_syntax_supported! lang
  func = "(function(code){ var a = new SyntaxHighlighter.brushes.#{lang}; a.init(); return a.getHtml(code); })"
  context.call func, code
end
supported_syntaxes() click to toggle source
Calls superclass method HLJS::Adapter#supported_syntaxes
# File lib/hljs/adapters/syntax_highlighter.rb, line 15
def supported_syntaxes
  super{ context.eval("Object.keys(SyntaxHighlighter.brushes)") }
end
version() click to toggle source
# File lib/hljs/adapters/syntax_highlighter.rb, line 19
def version
  source[/@version\n[\s*]+([\d.]+)/, 1]
end