remark-sub-super v1.0.21
remark-sub-super

This plugin parses custom Markdown syntax to handle subscript and superscript. It adds new nodes types to the mdast produced by remark:
subsup
If you are using rehype, the stringified HTML result will be sub or sup.
Syntax
~subscript~, e.g. a~i~
^superscript^, e.g. e^x^AST (see mdast specification)
Sub (Parent) represents a subscript text.
interface Sub <: Parent {
type: "sub";
}Sup (Parent) represents a superscript text.
interface Sup <: Parent {
type: "sup";
}For example, the following markdown:
a^x^
x~i~Yields:
{
type: 'paragraph',
children: [{
type: 'text',
value: 'a',
children: [{
type: 'sup',
children: [{
type: 'text',
value: 'x'
}]
}]
}]
},
{
type: 'paragraph',
children: [{
type: 'text',
value: 'x',
children: [{
type: 'sub',
children: [{
type: 'text',
value: 'i'
}]
}]
}]
}Rehype
This plugin is compatible with rehype. Sub mdast nodes will become <sub>contents</sub>, Sup mdast nodes will become <sup>contents</sup>.
Installation
npm:
npm install remark-sub-superUsage
Dependencies:
const unified = require('unified')
const remarkParse = require('remark-parse')
const stringify = require('rehype-stringify')
const remark2rehype = require('remark-rehype')
const remarkSubSuper = require('remark-sub-super')Usage:
unified()
.use(remarkParse)
.use(remarkSubSuper)
.use(remark2rehype)
.use(stringify)License
2 years ago
5 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago