Module: Neo4j::AsciidoctorExtensions::InlineHighlighter
- Includes:
- Asciidoctor
- Defined in:
- lib/neo4j/asciidoctor/extensions/inline_highlighter_rouge/extension.rb
Overview
Inline syntax highlighter based on Rouge.
Defined Under Namespace
Classes: MonospacedTextInlineMacro, SrcInlineMacro
Class Method Summary collapse
Class Method Details
.highlight_code(lang, text, doc) ⇒ Object
14 15 16 17 18 19 20 21 |
# 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 |