Sha256: dd719562d615871426be08b1f3e69787ecd61f0f6bf743ca9f2645b90d1229e6

Contents?: true

Size: 915 Bytes

Versions: 11

Compression:

Stored size: 915 Bytes

Contents

# -*- coding: utf-8; frozen_string_literal: true -*-
#
#--
# Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown which is licensed under the MIT.
#++
#

module Kramdown::Converter::MathEngine

  # 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.
  module Mathjax

    def self.call(converter, el, opts)
      value = converter.escape_html(el.value)
      result = el.options[:category] == :block ?  "\\[#{value}\\]\n" : "\\(#{value}\\)"
      if el.attr.empty?
        result
      elsif el.options[:category] == :block
        converter.format_as_block_html('div', el.attr, result, opts[:indent])
      else
        converter.format_as_span_html('span', el.attr, "$#{el.value}$")
      end
    end

  end

end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/kramdown-2.4.0/lib/kramdown/converter/math_engine/mathjax.rb
kramdown-2.4.0 lib/kramdown/converter/math_engine/mathjax.rb
kramdown-2.3.2 lib/kramdown/converter/math_engine/mathjax.rb
kramdown-2.3.1 lib/kramdown/converter/math_engine/mathjax.rb
daqing_kramdown-2.3.2 lib/kramdown/converter/math_engine/mathjax.rb
daqing_kramdown-2.3.1 lib/kramdown/converter/math_engine/mathjax.rb
zine_brewer-1.5.0 vendor/bundle/ruby/2.7.0/gems/kramdown-2.3.0/lib/kramdown/converter/math_engine/mathjax.rb
zine_brewer-1.3.0 vendor/bundle/ruby/2.7.0/gems/kramdown-2.3.0/lib/kramdown/converter/math_engine/mathjax.rb
kramdown-2.3.0 lib/kramdown/converter/math_engine/mathjax.rb
kramdown-2.2.1 lib/kramdown/converter/math_engine/mathjax.rb
kramdown-2.2.0 lib/kramdown/converter/math_engine/mathjax.rb