Socket
Socket
Sign inDemoInstall

hexo-filter-mathjax

Package Overview
Dependencies
8
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hexo-filter-mathjax

Server side MathJax renderer plugin for Hexo.


Version published
Weekly downloads
520
decreased by-1.7%
Maintainers
1
Install size
38.8 MB
Created
Weekly downloads
 

Readme

Source

Hexo Filter MathJax

npm-image lic-image

Server side MathJax Renderer Plugin for Hexo.

WARNING: This plugin is a server-side math rendering plugin, which does not depend on any front-end scripts. If you have already enabled other math rendering methods before installing this plugin, please do the following to avoid conflicts:

  • Remove all other Hexo math plugins
  • Disable front-end math renderer in Hexo theme settings (For theme NexT, you need to set both math.mathjax.enable and math.katax.enable to false)
  • Delete front-end scripts related to math rendering

Installation

size-image dm-image dt-image

$ npm install hexo-filter-mathjax
$ hexo clean

Options

You can configure this plugin in Hexo _config.yml. Default options:

mathjax:
  tags: none # or 'ams' or 'all'
  single_dollars: true # enable single dollar signs as in-line math delimiters
  cjk_width: 0.9 # relative CJK char width
  normal_width: 0.6 # relative normal (monospace) width
  append_css: true # add CSS to pages rendered by MathJax
  every_page: false # if true, every page will be rendered by MathJax regardless the `mathjax` setting in Front-matter
  packages: # extra packages to load
  extension_options: {}
    # you can put your extension options here
    # see http://docs.mathjax.org/en/latest/options/input/tex.html#tex-extension-options for more detail

Usage

Set mathjax: true in Front-matter of each article (post / page) that you would like to enable MathJax. For example:

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

Then you can use the LaTeX syntax in the article.

Renderer

hexo-renderer-pandoc is recommended because it can handle mathematical formulas in markdown documents perfectly. But you need to be aware that inline Math (..$...$) must not have white spaces after the opening $ and before the ending $. For example:

-$ \epsilon_0 $
+$\epsilon_0$
-$ \frac{\partial}{\partial t} $
+$\frac{\partial}{\partial t}$

If you are using other renderers, such as hexo-renderer-marked, you need to be aware of the conflict between LaTeX and Markdown syntax. For example, an underscore (_) may be interpreted as the start of italic text in Markdown, or subscripted mark in TeX. Use \ to escape if necessary:

-$\epsilon_0$
+$\epsilon\_0$
-\begin{eqnarray*}
+\begin{eqnarray\*}
-\\
+\\\\

Sample

Write the following LaTeX code:

$$
i\hbar\frac{\partial}{\partial t}\psi=-\frac{\hbar^2}{2m}\nabla^2\psi+V\psi
$$
\begin{eqnarray\*}
\nabla\cdot\vec{E}&=&\frac{\rho}{\epsilon_0}\\\\
\nabla\cdot\vec{B}&=&0\\\\
\nabla\times\vec{E}&=&-\frac{\partial B}{\partial t}\\\\
\nabla\times\vec{B}&=&\mu_0\left(\vec{J}+\epsilon_0\frac{\partial E}{\partial t}\right)\\\\
\end{eqnarray\*}

Then you will get:

Known Issues

Long equations with labels may cause horizontal overflow, because a min-width CSS property will be added to mjx-container elements by MathJax.

License

Released under the MIT License

Keywords

FAQs

Last updated on 03 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc