lib/asciidoctor/katex/ruby_katex_adapter.rb
# Renders the given math expression to HTML using KaTeX.
#
# @param math [String] the math (LaTeX) expression.
# @param opts [Hash] options for `katex.renderToString`.
#   Keys in under_score notation will be converted to camelCase.
#   See <https://github.com/Khan/KaTeX#rendering-options>.
# @return [String] a rendered HTML fragment.
Renders the given math expression to HTML using KaTeX.
Renders the given math expression to HTML using KaTeX .
def render(math, opts = {})
      opts = @default_options.merge(hash_camelize(opts))
      opts[:throw_on_error] = opts[:throwOnError]
      opts[:error_color] = opts[:errorColor] || '#cc0000'
      begin
        ::Katex.render(math, **opts)
      rescue ::ExecJS::ProgramError => err
        raise ParseError.new(err, math) if err.to_s.start_with?('ParseError:')
        raise KatexError.new(err, math)
      end
    end
def render ( math , opts = { } ) opts = @default_options . merge ( hash_camelize ( opts ) ) opts [ :throw_on_error ] = opts [ :throwOnError ] opts [ :error_color ] = opts [ :errorColor ] || '#cc0000' begin :: Katex . render ( math , ** opts ) rescue :: ExecJS :: ProgramError => err raise ParseError . new ( err , math ) if err . to_s . start_with? ( 'ParseError:' ) raise KatexError . new ( err , math ) end end
Renders the given math expression to HTML using KaTeX.
Renders the given math expression to HTML using KaTeX .
a rendered HTML fragment.
a rendered HTML fragment .
String
math
the math (LaTeX) expression.
the math ( LaTeX ) expression .
opts
options for `katex.renderToString`. Keys in under_score notation will be converted to camelCase. See .
options for ` katex . renderToString ` . Keys in under_score notation will be converted to camelCase . See .