module Kramdown::Converter::MathEngine::Mathjax

Uses the MathJax javascript library for displaying math.

Note that the javascript library itself is not include or linked, this has to be done separately. Only the math content is marked up correctly.

Public Class Methods

call(converter, el, opts) click to toggle source
   # File lib/kramdown/converter/math_engine/mathjax.rb
17 def self.call(converter, el, opts)
18   value = converter.escape_html(el.value)
19   result = el.options[:category] == :block ?  "\\[#{value}\\]\n" : "\\(#{value}\\)"
20   if el.attr.empty?
21     result
22   elsif el.options[:category] == :block
23     converter.format_as_block_html('div', el.attr, result, opts[:indent])
24   else
25     converter.format_as_span_html('span', el.attr, "$#{el.value}$")
26   end
27 end