Skip to main content

@mdit/plugin-sub


Plugin to support subscript.

Usage

TS
import MarkdownIt from "markdown-it";
import { sub } from "@mdit/plugin-sub";

const mdIt = MarkdownIt().use(sub);

mdIt.render("H~2~O");

Syntax

Use ~ ~ to mark the subscript.

Escaping

  • You can use \ to escape ~:

    H\~2~O
    

    will be

    H~2~O

Demo

H~2~O: H2O