Class: Jekyll::Converters::Mathematical

Inherits:
Converter
  • Object
show all
Defined in:
lib/jekyll-mathematical.rb

Instance Method Summary collapse

Instance Method Details

#convert(content) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/jekyll-mathematical.rb', line 17

def convert(content)
  MathToItex(content).convert do |eq, type|
    svg_content = ::Mathematical::Render.new(:base64 => true).render(eq)

    %|<img class="#{type.to_s}-math" data-math-type="#{type.to_s}-math" src="#{svg_content['svg']}"/>|
  end
end

#matches(ext) ⇒ Object



9
10
11
# File 'lib/jekyll-mathematical.rb', line 9

def matches(ext)
  ext =~ /^\.md$/i
end

#output_ext(ext) ⇒ Object



13
14
15
# File 'lib/jekyll-mathematical.rb', line 13

def output_ext(ext)
  ".html"
end