module Neo4j::AsciidoctorExtensions::InlineHighlighter
Inline syntax highlighter based on Rouge
.
Public Class Methods
highlight_code(lang, text, doc)
click to toggle source
# File lib/neo4j/asciidoctor/extensions/inline_highlighter_rouge/extension.rb, line 14 def self.highlight_code(lang, text, doc) return '' if text.nil? || text.strip.empty? lexer = Rouge::Lexer.find lang theme = Rouge::Theme.find(doc.attr('rouge-style', 'github')).new formatter = Rouge::Formatters::HTMLInline.new(theme) formatter.format(lexer.lex(text)) end