Sha256: 4bed88aad2fa0d109a1f592f2f668b39340796aa70e9d72c95252eb59e02f43b

Contents?: true

Size: 755 Bytes

Versions: 30

Compression:

Stored size: 755 Bytes

Contents

import katex from '../katex.mjs';

let scripts = document.body.getElementsByTagName("script");
scripts = Array.prototype.slice.call(scripts);
scripts.forEach(function (script) {
  if (!script.type || !script.type.match(/math\/tex/i)) {
    return -1;
  }

  const display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
  const katexElement = document.createElement(display ? "div" : "span");
  katexElement.setAttribute("class", display ? "equation" : "inline-equation");

  try {
    katex.render(script.text, katexElement, {
      displayMode: display
    });
  } catch (err) {
    //console.error(err); linter doesn't like this
    katexElement.textContent = script.text;
  }

  script.parentNode.replaceChild(katexElement, script);
});

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
jekyll-theme-hydejack-9.2.1 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.2.0 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.9 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.8 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.7 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.6 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.5 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.4 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.3 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.2 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.1 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.1.0 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.0.4 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.0.3 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.0.2 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.0.1 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-9.0.0 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydebetty-1.0.2 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydebetty-1.0.1 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs
jekyll-theme-hydejack-8.5.2 assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs