yarn add -D chin chin-plugin-unified
Just using processor.use()
.
import unified from 'chin-plugin-unified'
import md2mdast from 'remark-parse'
import mdast2hast from 'remark-rehype'
import hastformat from 'rehype-format'
import hast2html from 'rehype-stringify'
// as list
const md = unified('.html', [
[md2mdast, {}],
[mdast2hast, {}],
[hastformat, {}],
[hast2html, {}]
])
// as preset
const md = unified('.html', {
settings: {},
plugins: [
[md2mdast, {}],
[mdast2hast, {}],
[hastformat, {}],
[hast2html, {}]
]
})
Determines parser/compiler(/extension) by type
.
import unified from 'chin-plugin-unified'
import mdast2hast from 'remark-rehype'
import hastformat from 'rehype-format'
// as list
const md = unified('m2h', [
[mdast2hast, {}],
[hastformat, {}]
])
// as options
const md = unified('m2h', {
parse: {},
compile: {},
settings: {},
plugins: [
[mdast2hast, {}],
[hastformat, {}]
]
})
value | parser | compiler | required in list |
---|---|---|---|
"h2h" |
rehype-parser |
rehype-stringify |
|
"h2m" |
rehype-parser |
remark-stringify |
rehype-remark |
"m2m" |
remark-parser |
remark-stringify |
|
"m2h" |
remark-parser |
rehype-stringify |
remark-rehype |
setting
plugins
set tolist
parse
options passed to parser.compile
options passed to compiler.