Class: Asciidoctor::Katex::Treeprocessor
- Inherits:
-
Extensions::Treeprocessor
- Object
- Extensions::Treeprocessor
- Asciidoctor::Katex::Treeprocessor
- Defined in:
- lib/asciidoctor/katex/treeprocessor.rb
Overview
Asciidoctor processor that renders delimited latexmath expressions using the KaTeX library.
Instance Method Summary collapse
-
#initialize(katex_options: {}, katex_renderer: nil, require_stem_attr: true) ⇒ Treeprocessor
constructor
A new instance of Treeprocessor.
- #process(document) ⇒ Object
Constructor Details
#initialize(katex_options: {}, katex_renderer: nil, require_stem_attr: true) ⇒ Treeprocessor
Returns a new instance of Treeprocessor.
25 26 27 28 29 |
# File 'lib/asciidoctor/katex/treeprocessor.rb', line 25 def initialize(katex_options: {}, katex_renderer: nil, require_stem_attr: true, **) @katex_renderer = katex_renderer || KatexAdapter.new() @require_stem_attr = require_stem_attr super end |
Instance Method Details
#process(document) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/asciidoctor/katex/treeprocessor.rb', line 32 def process(document) return if skip? document converter = document.instance_variable_get(:@converter) decorator = StemConverterDecorator.new(converter, @katex_renderer) document.instance_variable_set(:@converter, decorator) nil end |