Skip to content
Superscript and Subscript

Superscript and Subscript

Posted Updated
By 廿四1 min Read

Setting

.vitepress/config.ts
ts
import { defineConfig } from 'vitepress-theme-niansi'

export default defineConfig({
  markdown: {
    plugins: {
      // Enable Subscript
      sub: true,
      // Enable Superscript
      sup: true
    }
  }
})

Syntax

  • Use ^ ^ to mark the superscript.
  • Use ~ ~ to mark the subscript.

Example

19th

H2O

Demo
md
19^th^

H~2~O

Tips

You can use \ to escape ^ and ~:

H~2~O 19^th^

Changelog

2026-04-18 23:33
View All Changelog