VuePress EcosystemVuePress Ecosystem
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • English
  • 简体中文
GitHub
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • English
  • 简体中文
GitHub
  • append-date
  • markdown-container
  • markdown-ext
  • markdown-image
  • markdown-include
  • markdown-hint
  • markdown-math
  • markdown-stylize
  • markdown-tab
  • links-check
  • prismjs
  • revealjs
    • revealjs
    • Slide Demo
    • Reveal.js Themes
  • shiki

markdown-math

@vuepress/plugin-markdown-math

Add math support to your VuePress site.

This plugin allows you to use mathjax or katex to render TeX\TeXTE​X in your markdown content.

Usage

npm i -D @vuepress/plugin-markdown-math@next

# install one of the following packages:
npm i -D mathjax-full
npm i -D katex
.vuepress/config.ts
import { markdownMathPlugin } from '@vuepress/plugin-markdown-math'

export default {
  plugins: [
    markdownMathPlugin({
      // options
    }),
  ],
}

Syntax

  • Inline mode: $xxx$

    Euler's identity eiπ+1=0e^{i\pi}+1=0eiπ+1=0 is a beautiful formula in R2\mathbb{R}^2R2.

    Euler's identity $e^{i\pi}+1=0$ is a beautiful formula in $\mathbb{R}^2$.
  • Display mode:

    $$xxx$$
    
    $$
    xxx
    $$

    ∂r∂ωr(yωω)=(yωω){(log⁡y)r+∑i=1r(−1)Ir⋯(r−i+1)(log⁡y)riωi}\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right) = \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^ Ir \cdots (r-i+1) (\log y)^{ri}} {\omega^i} \right\} ∂ωr∂r​(ωyω​)=(ωyω​){(logy)r+i=1∑r​ωi(−1)Ir⋯(r−i+1)(logy)ri​}

    $$
    \frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right)
    = \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^ Ir \cdots (r-i+1) (\log y)^{ri}} {\omega^i} \right\}
    $$

Escaping

Escaping can be done by using \ before the $ character, or adding space both before and after the $ character.

The a=1a=1a=1 is a TeX equation, while $ a=1 $ and $a=1$ is not.

The $a=1$ is a TeX equation, while $ a=1 $ and \$a=1$ is not.

Support List

TeX Tutorial:

  • TeX Tutorial
  • TeX Cheat Sheets

Plugin tutorial and FAQs: TeX

Katex:

  • KaTeX Support Features
  • KaTeX Support List

Mathjax:

  • Supported TeX/LaTeX commands

Options

type

  • Type: 'katex' | 'mathjax'

  • Details:

    The package to render TeX\TeXTE​X contents.

    • 'katex': use KaTeX
    • 'mathjax': use MathJax

    When this options is not specified, the plugin will try to detect which package is installed. If both are installed, it will use "mathjax".

Using KaTeX

When using KaTeX, any other options will be passed to KaTeX as KatexOptions. See KaTeX Docs for all available options.

Besides, 2 special options are supported:

  • copy: enable copy extension or not.
  • mhchem: enable mhchem extension or not.

Using MathJax

When using MathJax, you can set:

  • tex: options which is passed to TeX input parser
  • output: either 'svg' (default) or 'chtml' to change output format between SVG and HTML.
  • chtml: options which is passed to Common HTML output parser
  • svg: options which is passed to SVG output parser
Edit this page on GitHub
Last Updated:: 4/12/25, 7:03 PM
Contributors: 张怀文, pengzhanbo, Mister-Hope
Prev
markdown-hint
Next
markdown-stylize