Sha256: 95ede7eedf781b025d971c3611c22c13bfe6ad5fec6ba29ac6c4635a5aa6b675
Contents?: true
Size: 908 Bytes
Versions: 2
Compression:
Stored size: 908 Bytes
Contents
# -*- coding: utf-8 -*- # #-- # Copyright (C) 2018 Gleb Mazovetskiy <glex.spb@gmail.com> # # This file is part of kramdown which is licensed under the MIT. #++ module Kramdown::Converter::MathEngine # Uses the KaTeX gem for converting math formulas to KaTeX HTML. module Katex AVAILABLE = begin require 'katex' true rescue LoadError false end def self.call(converter, el, opts) display_mode = el.options[:category] == :block result = ::Katex.render( el.value, display_mode: display_mode, throw_on_error: false, **converter.options[:math_engine_opts] ) attr = el.attr.dup attr.delete('xmlns') attr.delete('display') result.insert(result =~ /[[:space:]>]/, converter.html_attributes(attr)) result = "#{' ' * opts[:indent]}#{result}\n" if display_mode result end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
files.com-1.0.55 | docs/vendor/bundle/ruby/2.5.0/gems/kramdown-1.17.0/lib/kramdown/converter/math_engine/katex.rb |
kramdown-1.17.0 | lib/kramdown/converter/math_engine/katex.rb |