lib/asciidoctor/katex/opal_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))
      begin
        `#{@katex_object}.renderToString(#{math}, #{opts}.$$smap)`
      rescue ::JS::Error => err
        raise ParseError.new(err, math) if "#{err}".start_with?('ParseError:')
        raise KatexError.new(err, math)
      end
    end
def render ( math , opts = { } ) opts = @default_options . merge ( hash_camelize ( opts ) ) begin ` #{ @katex_object } .renderToString( #{ math } ,  #{ opts } .$$smap) ` rescue :: JS :: Error => err raise ParseError . new ( err , math ) if "#{err}" . 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 .
# "#{err}" is really needed for Opal/JS, #to_s returns a different string. # rubocop:disable UnneededInterpolation
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 .