Class: Jekyll::Tags::Katex
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Jekyll::Tags::Katex
- Defined in:
- lib/jekyll/tags/katex.rb
Overview
Defines the custom Liquid tag for compile-time rendering of KaTeX math
{% katex %}
<latex math>
{% endkatex %}
Constant Summary collapse
- LOG_TOPIC =
'Katex Block:'
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ Katex
constructor
A new instance of Katex.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ Katex
Returns a new instance of Katex.
16 17 18 19 20 21 |
# File 'lib/jekyll/tags/katex.rb', line 16 def initialize(tag_name, markup, tokens) super @markup = markup @tokens = tokens @display = markup.include? 'display' end |
Instance Method Details
#render(context) ⇒ Object
23 24 25 26 27 |
# File 'lib/jekyll/tags/katex.rb', line 23 def render(context) latex_source = super = Jekyll::Katex::Configuration..merge(displayMode: @display) KATEX.call('katex.renderToString', latex_source, ) end |