class DaimonMarkdown::Plugin::Math
Public Class Methods
script_tag()
click to toggle source
# File lib/daimon_markdown/plugin/math.rb, line 6 def self.script_tag tag = <<~TAG <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$']]}, asciimath2jax: {delimiters: [['`', '`']]}, TeX: {extensions: ["mhchem.js"]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> TAG if tag.respond_to?(:html_safe) tag.html_safe else tag end end
Public Instance Methods
call(expression)
click to toggle source
# File lib/daimon_markdown/plugin/math.rb, line 27 def call(expression) if expression.start_with?("$$") node.parent.replace(%Q(<div class="math">#{expression}</div>)) else result[:plugins] << expression end end