Sha256: a764ce2a8a793e3d96a68d8bbafc0b027b20a48441e91d2463148adf4cb7cee0
Contents?: true
Size: 813 Bytes
Versions: 6
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true require 'jekyll-katex/configuration' require 'jekyll-katex/katex_js' module Jekyll module Tags # Defines the custom Liquid tag for compile-time rendering of KaTeX math # {% katex %} # <latex math> # {% endkatex %} class Katex < Liquid::Block LOG_TOPIC = 'Katex Block:' KATEX ||= Jekyll::Katex::KATEX_JS def initialize(tag_name, markup, tokens) super @markup = markup @tokens = tokens @display = markup.include? 'display' end 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 end end end
Version data entries
6 entries across 6 versions & 1 rubygems