🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

remark-supersub

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-supersub

Remark plugin for adding subscript/superscript syntax.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
113K
12.31%
Maintainers
1
Weekly downloads
 
Created
Source

remark-supersub

CI/CD Status MIT License stars

Remark plugin for adding support for pandoc-style superscript and subscript syntax to Markdown.

Adds two new node types to MDAST: superscript and subscript. When using rehype, these will be stringified as sup and sub respectively.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install remark-supersub

Syntax

21^st^ Century

H~2~O

AST

The example above will yield:

{
  type: 'paragraph',
  children: [
    {
      type: 'text',
      value: '21'
    },
    {
      type: 'superscript',
      children: [{
        type: 'text',
        value: 'st'
      }]
    },
    {
      type: 'text',
      value: ' Century'
    }
  ]
}
...
{
  type: 'paragraph',
  children: [
    {
      type: 'text',
      value: 'H'
    },
    {
      type: 'subscript',
      children: [{
        type: 'text',
        value: '2'
      }]
    },
    {
      type: 'text',
      value: 'O'
    }
  ]
}

Usage

import { unified } from 'unified'
import markdown from 'remark-parse'
import html from 'rehype-stringify'
import remark2rehype from 'remark-rehype'
import supersub from 'remark-supersub'

unified()
  .use(markdown)
  .use(supersub)
  .use(remark2rehype)
  .use(html)

License

MIT © Alex Shaw

Keywords

remark

FAQs

Package last updated on 20 Aug 2021

Did you know?

Socket

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