0.0.4 • Published 8 years ago
chin-plugin-unified v0.0.4
chin-plugin-unified
Installation
yarn add -D chin chin-plugin-unifiedUsage
unified(extension, list|preset)
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, {}]
]
})unified(type, list|options)
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, {}]
]
})type
| 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 |
options ( extends preset )
settingpluginsset tolistparseoptions passed to parser.compileoptions passed to compiler.