class Jekyll::Tags::Katex

Defines the custom Liquid tag for compile-time rendering of KaTeX math

{% katex %}
<latex math>
{% endkatex %}

Constants

LOG_TOPIC

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/jekyll/tags/katex.rb, line 16
def initialize(tag_name, markup, tokens)
  super
  @markup = markup
  @tokens = tokens
  @display = markup.include? 'display'
end

Public Instance Methods

render(context) click to toggle source
Calls superclass method
# File lib/jekyll/tags/katex.rb, line 23
def render(context)
  latex_source = super
  rendering_options = Jekyll::Katex::Configuration.global_rendering_options.merge(displayMode: @display)
  KATEX.call('katex.renderToString', latex_source, rendering_options)
end