npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-math-fastcdn

v5.0.1

Published

Add KaTeX and MathJax support to Hexo

Downloads

56

Readme

hexo-math

Tester npm version npm license npm download

Embed KaTeX and MathJax in Hexo post/page via tag plugins. Equations are rendered in Hexo (server-side), so browser-side javascript library is not needed and should be removed. CSS stylesheets are included by default but can be easily replaced.

Installation

$ npm i hexo-math --save
  • Requires Hexo 5+

Usage

KaTeX

{% katex '{options}' %}
content
{% endkatex %}

Examples

{% katex %}
c = \pm\sqrt{a^2 + b^2}
{% endkatex %}

Override front-matter and global options for a particular content. Options must be specified in JSON format.

{% katex '{ "output": "mathml", "felqn": true, "minRuleThickness": 0.05, "throwOnError": true }' %}
c = \pm\sqrt{a^2 + b^2}
{% endkatex %}

MathJax

{% mathjax '{options}' %}
content
{% endmathjax %}

Examples

{% mathjax %}
\frac{1}{x^2-1}
{% endmathjax %}

Override front-matter and global options for a particular content. Options must be specified in JSON format.

{% mathjax '{ "conversion": { "em": 14 }, "tex": { "tags": "ams" }, "svg": { "exFactor": 0.03 } }' %}
\frac{1}{x^2-1}
{% endmathjax %}

Per-article configuration

Override the global options via the front-matter of an article (post/page) basis.

---
title: On the Electrodynamics of Moving Bodies
categories: Physics
date: 1905-06-30 12:00:00
katex: false
mathjax: false
---

Options

Disable math renderer in an article:

---
katex: false
mathjax: false
---

Override global options:

---
katex:
  output: 'mathml'
  felqn: true
  minRuleThickness: 0.05
  throwOnError: true
mathjax:
  conversion:
    em: 14
  tex:
    tags: 'ams'
  svg:
    exFactor: 0.03
---

Global Options

# _config.yml
math:
  katex:
    css: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css'
    options:
      throwOnError: false
  mathjax:
    css: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css'
    options:
      conversion:
        display: false
      tex:
      svg:
  • css: Location of stylesheet.
    • Specify a relative path if you're self-hosting the stylesheet.
      • Example: css: '/css/style.css' refers to source/css/style.css or themes/<theme-name>/source/css/style.css.
    • It can be disabled (css: false) if the installed theme has already included one.

KaTeX

  katex:
    options:
      throwOnError: false

MathJax

  mathjax:
    options:
      conversion:
        display: false
      tex:
      svg:

Configuration priority

Unique options are combined, if there is any duplicate options, argument overrides front-matter, front-matter overrides global options.

Example:

{% katex '{ "output": "html", "felqn": true }' %}
content
{% endkatex %}
# front-matter
---
katex:
  output: 'mathml'
  minRuleThickness: 0.05
  throwOnError: true
---
# _config.yml
math:
  katex:
    options:
      minRuleThickness: 0.03
      maxExpand: 900

Following options will be parsed as argument for that specific content:

{
  output: 'html',
  felqn: true,
  minRuleThickness: 0.05,
  throwOnError: true,
  maxExpand: 900
}

Similar project

  • hexo-filter-mathjax: A MathJax plugin developed by @stevenjoezhang, who is also a Hexo developer. It enables you to write LaTeX in-line within your post without using a tag {% %}.
    • hexo-math uses tag plugin approach due to minor incompatibility between LaTeX and marked, the default markdown renderer of Hexo (via hexo-renderer-marked).