Module: Kramdown::Converter::MathEngine::Itex2MML

Defined in:
lib/kramdown/converter/math_engine/itex2mml.rb

Overview

Uses the Itex2MML library for converting math formulas to MathML.

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.call(converter, el, opts) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/kramdown/converter/math_engine/itex2mml.rb', line 21

def self.call(converter, el, opts)
  type = el.options[:category]
  parser = ::Itex2MML::Parser.new
  result = (type == :block ? parser.block_filter(el.value) : parser.inline_filter(el.value))

  attr = el.attr.dup
  attr.delete('xmlns')
  attr.delete('display')
  result.insert("<math".length, converter.html_attributes(attr))

  (type == :block ? "#{' ' * opts[:indent]}#{result}\n" : result)
end