Class: Neo4j::AsciidoctorExtensions::InlineHighlighter::MonospacedTextInlineMacro
- Inherits:
-
Extensions::InlineMacroProcessor
- Object
- Extensions::InlineMacroProcessor
- Neo4j::AsciidoctorExtensions::InlineHighlighter::MonospacedTextInlineMacro
- Defined in:
- lib/neo4j/asciidoctor/extensions/inline_highlighter_rouge/extension.rb
Overview
Apply syntax highlighting on monospaced text cypher:
Usage:
# [src-cypher]‘MATCH (c:Customer ’ABCCO’) RETURN c.BOUGHT.productName`
Instance Method Summary collapse
Instance Method Details
#process(parent, target, attrs) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/neo4j/asciidoctor/extensions/inline_highlighter_rouge/extension.rb', line 35 def process(parent, target, attrs) raw_text = attrs[:content] raw_text = raw_text.gsub('→', '->') if raw_text.include? '&' raw_text = raw_text.gsub('←', '<-') if raw_text.include? '&' highlighted_text = InlineHighlighter.highlight_code(target, raw_text, parent.document) create_inline_pass parent, %(<code class="rouge">#{highlighted_text}</code>), attrs end |