Skip to main content

Superscript and Subscript

Less than 1 minuteMarkdownMarkdownSuperscriptSubscript

Let the Markdown file in your VuePress site support Subscript and Superscript.

Config

// .vuepress/config.ts
import { defineUserConfig } from "vuepress";
import { hopeTheme } from "vuepress-theme-hope";

export default defineUserConfig({
  theme: hopeTheme({
    plugins: {
      mdEnhance: {
        // Enable Subscript
        sub: true,
        // Enable  Superscript
        sup: true,
      },
    },
  }),
});







 
 
 
 
 
 



Syntax

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

Escaping

  • You can use \ to escape ^ and ~:

    H\~2~O 19\^th^
    

    will be

    H~2~O 19^th^

Demo

  • 19th
  • H2O
- 19^th^
- H~2~O